File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes A handy chart for  Math class. Check it out. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "A handy chart for  Math class. Check it out." Watch "A handy chart for  Math class. Check it out." New topic
Author

A handy chart for Math class. Check it out.

maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
While preparing for the Exam I wrote a small Java appln. to test the Math class's abs(),floor(),ceil(),round() methods for various input values. I thought it may be helpful for others also to verify their readiness in Math class. Any comments welcome. (The Table is well below this page. I don't know why these new lines are added.)
<table BORDER=0 > <tr > <td ></td> <td></td> </tr> <tr > <td></td> <td > <table ID="Table1" BORDER=1 > <tr> <td > Input (double)</td> <td > round() (long)</td> <td > ceil() (double)</td> <td > floor() (double)</td> <td > abs() (double)</td> </tr> <tr> <td > Double.NaN or Float.Nan</td> <td > 0</td> <td > Nan</td> <td > Nan</td> <td > Nan</td> </tr> <tr> <td > Double.NEGATIVE_INFINITY</td> <td > -9223372036854775808 Long.MIN_VALUE</td> <td > -Infinity</td> <td > -Infinity</td> <td > Infinity</td> </tr> <tr> <td > Double.POSITIVE_INFINITY</td> <td > 9223372036854775807 Long.MAX_VALUE</td> <td > Infinity</td> <td > Infinity</td> <td > Infinity</td> </tr> <tr> <td > Float.NEGATIVE_INFINITY</td> <td > -2147483648 Integer.MIN_VALUE</td> <td > -Infinity</td> <td > -Infinity</td> <td > Infinity</td> </tr> <tr> <td > Float.POSITIVE_INFINITY</td> <td > 2147483647 Integer.MAX_VALUE</td> <td > Infinity</td> <td > Infinity</td> <td > Infinity</td> </tr> <tr> <td > -4.3</td> <td > -4</td> <td > -4.0</td> <td > -5.0</td> <td > 4.3</td> </tr> <tr> <td > -99.1</td> <td > -99</td> <td > -99.0</td> <td > -100.0</td> <td > 99.1</td> </tr> <tr> <td > -99.0</td> <td > -99</td> <td > -99.0</td> <td > -99.0</td> <td > 99.0</td> </tr> <tr> <td > 99.0</td> <td > 99</td> <td > 99.0</td> <td > 99.0</td> <td > 99.0</td> </tr> <tr> <td > -0.01</td> <td > 0</td> <td > �-0.0</td> <td > -1.0</td> <td > 0.01</td> </tr> <tr> <td > 0.1</td> <td > 0</td> <td > 1.0</td> <td > 0.0</td> <td > 0.1</td> </tr> <tr> <td > -4.0</td> <td > -4</td> <td > -4.0</td> <td > -4.0</td> <td > 4.0</td> </tr> <tr> <td > -4.5</td> <td > -4</td> <td > -4.0</td> <td > -5.0</td> <td > 4.5</td> </tr> <tr> <td > -4.7</td> <td > -5</td> <td > -4.0</td> <td > -5.0</td> <td > 4.7</td> </tr> <tr> <td >�</td> </tr> <tr> <td >

-inf ... Long.MIN.... Integer.MIN� ....-100� -99� -98... -1 -0.0�� 0.0� +1 .....98� 99� 100 .... Integer.MAX ... Long.MAX....+inf�� -- Remember this sale</td> </tr> <tr> <td >�</td> </tr> <tr> <td > Double.MIN_VALUE��� 4.9E-324����������������������� Double.MAX_VALUE��� 1.7976931348623157E308</td> </tr> <tr> <td > Float.MIN_VALUE������ 1.4E-45������������������������� Float.MAX_VALUE���� 3.4028235E38</td> </tr> <tr> <td > Long.MIN_VALUE����� -9223372036854775808� Long.MAX_VALUE���� 9223372036854775807</td> </tr> <tr> <td > Integer.MIN_VALUE�� -2147483648������������������� Integer.MAX_VALUE� 2147483647</td> </tr> <tr> <td >�</td> </tr> </table> </td> </tr> </table>

[This message has been edited by maha anna (edited February 29, 2000).]

maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
What happened? Jim....... Can you edit this Table?

[This message has been edited by maha anna (edited February 10, 2000).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A handy chart for Math class. Check it out.