| Author |
How int of Float.POSITIVE_INFINITY in Integer.MAX_VALUE?
|
Prashant Neginahal
Ranch Hand
Joined: Dec 04, 2002
Posts: 76
|
|
How int of Float.POSITIVE_INFINITY in Integer.MAX_VALUE? I mean , (int)Float.POSITIVE_INFINITY==Integer.MAX_VALUE gives true....? Prashant
|
--------------<br />Prashant<br />SCJP-91%
|
 |
Peter den Haan
author
Ranch Hand
Joined: Apr 20, 2000
Posts: 3252
|
|
Isn't that answered here? - Peter
|
 |
Harry Kong
Ranch Hand
Joined: Dec 06, 2002
Posts: 41
|
|
|
When you cast Float.POSITIVE_INFINITY down to int it will be masked to Integer.MAX_VALUE. And Float.NEGATIVE_INFINITY will be masked to Integer.MIN_VALUE. And Float.NaN will be masked to 0. This also works for Double and Long.
|
SCJP 1.4
|
 |
 |
|
|
subject: How int of Float.POSITIVE_INFINITY in Integer.MAX_VALUE?
|
|
|