> what is the maximum whole number value a float can be used to represent? (32bit)
Do not use float to represent whole numbers.
On my implementation, (where the representation of float has 32 total bits with the mantissa having 24 bits),
a float can represent the whole numbers 33554430 ( ( 2^24 - 1 ) * 2 ) and 134217720 ( ( 2^24 - 1 ) * 2^3 ),
but can't represent 33554429, 33554431, 134217719 or 134217721.
@JLBorges:
I'm a little confused by the math you did.
The Mantissa is the significant bits, not the exponent.
If the exponent is 8 bits, the maximum range would be from 2^-126 - 2^127 (Times the value of 1.mantissa), with 00 given the value of 0, and FF the value infinity. If I understand floats correctly?
EDIT: And if you need to represent very large numbers (At a slight cost of precision), floats are actually very good. An unsigned integer can only represent up to 2^32-1.
Think of it in terms of numbers this way: suppose the mantissa represents exactly ten decimal digits, and the exponent two decimal digits. So:
1.234567890 x 1009 == 1234567890
However:
1.234567890 x 1010 == 12345678900
The very next number has a gap of 1010-9 == 101:
1.234567891 x 1010 == 12345678910
As you already know, floats are stored in a way more convenient to binary arithmetic -- but the same principle holds. Unless the exponent exactly matches the number of digits in the mantissa's maximum value, you have gaps.