Author Topic:   A handy chart for Math class. Check it out.
maha anna
bartender
posted February 09, 2000 10:15 PM             
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.)












































































































































Input (double)

round() (long)

ceil() (double)

floor() (double)

abs() (double)

Double.NaN or Float.Nan

0

Nan

Nan

Nan

Double.NEGATIVE_INFINITY

-9223372036854775808 Long.MIN_VALUE

-Infinity

-Infinity

Infinity

Double.POSITIVE_INFINITY

9223372036854775807 Long.MAX_VALUE

Infinity

Infinity

Infinity

Float.NEGATIVE_INFINITY

-2147483648 Integer.MIN_VALUE

-Infinity

-Infinity

Infinity

Float.POSITIVE_INFINITY

2147483647 Integer.MAX_VALUE

Infinity

Infinity

Infinity

-4.3

-4

-4.0

-5.0

4.3

-99.1

-99

-99.0

-100.0

99.1

-99.0

-99

-99.0

-99.0

99.0

99.0

99

99.0

99.0

99.0

-0.01

0

 -0.0

-1.0

0.01

0.1

0

1.0

0.0

0.1

-4.0

-4

-4.0

-4.0

4.0

-4.5

-4

-4.0

-5.0

4.5

-4.7

-5

-4.0

-5.0

4.7

 

 -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

 


Double.MIN_VALUE    4.9E-324                        Double.MAX_VALUE    1.7976931348623157E308


Float.MIN_VALUE       1.4E-45                          Float.MAX_VALUE     3.4028235E38

Long.MIN_VALUE      -9223372036854775808  Long.MAX_VALUE     9223372036854775807

Integer.MIN_VALUE   -2147483648                    Integer.MAX_VALUE  2147483647

 

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

maha anna
bartender
posted February 09, 2000 10:23 PM             
What happened? Jim....... Can you edit this Table?

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

|