File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NaN

 
Stephanie Grasson
Ranch Hand
Posts: 347
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Try
System.out.println(Math.sqrt(-1.0));
Note that it does not throw any exception.
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Cata Lin.
That makes a lot of sense.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic