This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
pls help on NaN
Double.NaN comparison using equals method
Double Equals
NaN and .equals()
Double.NaN