I am reading Java puzzlers by Joshua Bloch. In puzzle 28, I am not able to understand following paragraph-
This works because the larger a floating-point value, the larger the distance between the value and its successor. This distribution of floating-point values is a consequence of their representation with a fixed number of significant bits. Adding 1 to a floating-point value that is sufficiently large will not change the value, because it doesn't "bridge the gap" to its successor.
- Why do larger floating point values have larger distances between their values and successors?
- In case of
Integer
, we add one to get the nextInteger
, but in case offloat
, how do we get nextfloat
value? If I have float value in IEEE-754 format, do I add 1 to the mantissa part to get next float?