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

Infinity

 
Thiru Thangavelu
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.out.println(-1 * Double.NEGATIVE_INFINITY);
prints infinity. What is happening here?
 
Corey McGlone
Ranch Hand
Posts: 3271
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Thiru Thangavelu:
System.out.println(-1 * Double.NEGATIVE_INFINITY);
prints infinity. What is happening here?

Why wouldn't it?
 
Thiru Thangavelu
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean, (-1) * (-)infinity = infinity.
i.e
(-) * (-) = (+)
It is same like other mathematical calcultations. Am i right?
 
Corey McGlone
Ranch Hand
Posts: 3271
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. In mathematics, if you multiply a value by -1, you simply flip the sign of that value.
 
Francisco A Guimaraes
Ranch Hand
Posts: 182
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same will happen if you do this:
Math.pow(Double.NEGATIVE_INFINITY,2)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic