Re: How to handle floats and avoid NaN
- From: "Googmeister" <googmeister@xxxxxxxxx>
- Date: 8 Sep 2005 15:12:08 -0700
Oliver Wong wrote:
> "Roedy Green" <look-on@xxxxxxxxxxxxxxxxxxxx> wrote in message
> news:edquh1hmapi6q7me2af7lkoq7968l96ptm@xxxxxxxxxx
> > On 7 Sep 2005 08:34:35 -0700, mehtakrishna2002@xxxxxxxxx wrote or
> > quoted :
> >
> >>I am trying to do some matrix manipulation using a matrix module in
> >>java that i downloaded from the web. When I deal with large matrices
> >>(60x60), I start getting NaN for a lot of my calculations. I think It
> >>is due to the way in which Java handles floats.
> >
> > 1. use doubles
> > 2. check earlier for NaNs rather than letting them propagate in
> > useless calculation.
> >
> > The problem is essentially some mathematical algorithms sometimes
> > produce infinities.
>
> AFAIK, IEEE standards (which Java uses), has values for positive and
> negative infinity which are distinct from NaN.
You are correct, but producing infinities can subsequently lead to
NaNs,
e.g., if you compute Infinity - Infinity.
.
- References:
- How to handle floats and avoid NaN
- From: mehtakrishna2002
- Re: How to handle floats and avoid NaN
- From: Roedy Green
- Re: How to handle floats and avoid NaN
- From: Oliver Wong
- How to handle floats and avoid NaN
- Prev by Date: Re: Transfer received image
- Next by Date: Re: choosing a package name
- Previous by thread: Re: How to handle floats and avoid NaN
- Next by thread: JSP security-session management
- Index(es):
Relevant Pages
|