2.6.1 - simple division
digitig at gmail.com
Mon Mar 9 20:12:06 CET 2009
2009/3/8 <farsight at gmail.com>:
>>>> 4 / 5.0
>>>> 0.8 * 5
> python 2.6.1 on mac. What the hell is going on here?
I know this has already been answered in detail, but one thing that
it's easy for those new to floating point issues to miss is that
fractions that can be expressed exactly in decimal can end up as
recurring decimals in binary. 0.8 looks nice and tidy, but in binary
(if I get this right) it's 0.1100110011001100..., recurring ad
infinitum. The computer has to truncate it somewhere.
More information about the Python-list