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


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

Infinity

Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
System.out.println(-1 * Double.NEGATIVE_INFINITY);
prints infinity. What is happening here?


Thanks,<br />Thiru<br />[SCJP,SCWCD,SCBCD]
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Originally posted by Thiru Thangavelu:
System.out.println(-1 * Double.NEGATIVE_INFINITY);
prints infinity. What is happening here?

Why wouldn't it?


SCJP Tipline, etc.
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
You mean, (-1) * (-)infinity = infinity.
i.e
(-) * (-) = (+)
It is same like other mathematical calcultations. Am i right?
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Yes. In mathematics, if you multiply a value by -1, you simply flip the sign of that value.
Francisco A Guimaraes
Ranch Hand

Joined: Mar 20, 2002
Posts: 182
The same will happen if you do this:
Math.pow(Double.NEGATIVE_INFINITY,2)


Francisco<br />SCJP<br />please use the [code][/code] tags when showing code.Click <a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=ubb_code_page" target="_blank" rel="nofollow">here</a> to see an example.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Infinity