as you know, int is 32-bits long and so is float. But the difference is that float has to keep decimal informations in these 32 bits, which means the maximum value of a float is less than the possible max value of an int.

See for yourself

Output:

2147483647 // == 2147483647

2.14748365E9 // == 2147483650

3.4028235E38 // == 340282350...

As you see, the conversion of int max value to float is not without risk of losing some precision, whereas the max value of a float is far less than the max value of an int...

In other words, when converting an int to a float back and forth, the bit

pattern does not change, it's just that a float interprets some bits in a different way that an int does, i.e.

**the couple last bits in a float are for the exponent**...

HIH

------------------

Valentin Crettaz

Sun Certified Programmer for

Java 2 Platform

[This message has been edited by Valentin Crettaz (edited November 13, 2001).]