representation error this section explains the " example in detailand shows how you can perform an exact analysis of cases like this yourself basic familiarity with binary floating-point representation is assumed representation error refers to the fact that some (mostactuallydecimal fractions cannot be represented exactly as binary (base fractions this is the chief reason why python (or perlcc++javafortranand many othersoften won' display the exact decimal number you expect why is that / is not exactly representable as binary fraction almost all machines today (november use ieee- floating point arithmeticand almost all platforms map python floats to ieee- "double precision doubles contain bits of precisionso on input the computer strives to convert to the closest fraction it can of the form / ** where is an integer containing exactly bits rewriting ~ ( **nas ~ ** and recalling that has exactly bits (is > ** but ** )the best value for is ** <true ** / ** that is is the only value for that leaves with exactly bits the best possible value for is then that quotient roundedqr divmod( ** since the remainder is more than half of the best approximation is obtained by rounding upq+ therefore the best possible approximation to / in double precision is * dividing both the numerator and denominator by two reduces the fraction to * note that since we rounded upthis is actually little bit larger than / if we had not rounded upthe quotient would have been little bit smaller than / but in no case can it be exactly / so the computer never "sees / what it sees is the exact fraction given abovethe best double approximation it can get * if we multiply that fraction by ** we can see the value out to decimal digits * / * floating point arithmeticissues and limitations