This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes About NAN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "About NAN" Watch "About NAN" New topic

About NAN

Xiao Song

Joined: Aug 29, 2006
Posts: 17
Hello,everyone, Why the result is false??

Thanks advance!!

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9749

0.0/0.0 is NaN and NaN is different from 0. Hence false.

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Xiao Song

Joined: Aug 29, 2006
Posts: 17
Thanks a lot.
In rt.jar NaN is defined as follows:

A constant holding the largest positive finite value of type
double,It is equal to the hexadecimal floating-point literal
0x1.fffffffffffffP+1023 and also equal to

What is this mean??
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Hi ranchers,
Xiao Song posted November 20, 2006 01:39 AM
Hello,everyone, Why the result is false??
when you perform arithmetic operation on NaN the result will also be not a number.
So NaN - NaN = NaN
and NaN is not zero.

Furthermor NaN is unuequal to everything, including itself (this may give you some headaches if you think about it).



all events occur in real time
Xiao Song

Joined: Aug 29, 2006
Posts: 17
Thanks Burkhard Hassel, His explonatio is very clear.
rocket mass heater kickstarter
subject: About NAN