Floating point multiplication in python
gherron at islandtraining.com
Tue Sep 6 09:00:39 CEST 2011
On 09/05/2011 10:57 PM, xyz wrote:
> hi all:
> As we know , 1.1 * 1.1 is 1.21 .
> But in python ,I got following :
>>>> 1.1 * 1.1
> why python get wrong result? Who can tell me where's the 0.0000000000000002 from?
It's not a python error It's the nature of floating point arithmetic
to be inaccurate on *ANY* computer. Python just allows you to see the
and see that the print statement does hide the roundoff error from you.)
Read this for more info:
More information about the Python-list