[Fwd: Formatted Read Accuracy]
Eljay Love-Jensen
eljay@adobe.com
Wed Oct 9 11:43:00 GMT 2002
Hi Blime,
Floating point numbers -- IEEE 754, 32-bit "float", 64-bit "double", or any
of the other more-or-less standard formats -- cannot perfectly represent
any arbitrary decimal portion of all rational numbers.
For instance, 0.5 can be perfectly represented.
Consider that "0.5" (decimal) is "0.8" (hexadecimal). Exactly.
0.1 cannot be perfectly represented.
Consider that "0.1" (decimal) would be
"0.1999999999999999999999999999999..." (hexadecimal). Since floating point
numbers do not have infinite precision, some rounding occurs.
To alleviate the problem, consider using fixed point numbers, or using BCD
numbers.
Sincerely,
--Eljay
More information about the Gcc-help
mailing list