aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes NaN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "NaN" Watch "NaN" New topic
Author

NaN

Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
I just got the RHE Java2 Certification study guide.
I was surprised to see that a double divided by 0 is equal to Double.NEGATIVE_INFINITY. All other books I had read said that a double divided by 0 was equal to Double.NaN.
Now I am curious. What sort of operation would result in Double.NaN?
cata lin
Ranch Hand

Joined: May 11, 2000
Posts: 44
Hi,
Try
System.out.println(Math.sqrt(-1.0));
Note that it does not throw any exception.
Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Thanks Cata Lin.
That makes a lot of sense.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NaN
 
Similar Threads
Double Equals
NaN and .equals()
Double.NaN comparison using equals method
Double.NaN
pls help on NaN