Representation error refers to fact that some (most, actually) decimal fractions cannot be represented exactly as binary (base 2) fractions. This is the chief reason why Python (or Perl, C, C++, Java, Fortran, and many others) often won’t display the exact decimal number you expect:
>>> 0.1
0.10000000000000001Why is that? 1/10 is not exactly representable as [...]
Archive for June, 2007
Representation Error in Python
Posted in Technology on June 7, 2007 | 1 Comment »