Originally Posted by Paul McKenzie
Well this concept really isn't a "C++" concept. It is a general concept with computers that floating point numbers cannot be represented exactly in a binary number system.
For example, 1.6 cannot be represented exactly in binary (it is a repeating, non-terminating binary floating point number). What the various "output" functions do in C++ is round-off the numbers for only display purposes -- the number internally is (for this case), not really 1.6, but maybe 1.5999999231 or something of that nature.
Back when hand-held calculators were first available, for some models if you entered "1/3x3" you would get "0.99999999", and not 1. Same reason as above.
So it is more of a "numerical analysis" concept as to why you can't represent most floating point numbers exactly in binary, and not a "language" concept.
Regards,
Paul McKenzie