Floating point multiplication in python
clp2 at rebertia.com
Tue Sep 6 02:18:30 EDT 2011
On Mon, Sep 5, 2011 at 10:57 PM, xyz <xyzhtml at 163.com> 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?
It's not Python's fault per se, rather it's the inherent nature of
binary floating-point arithmetic. Try the equivalent in most other
languages and you'll get the same "error".
Please read http://docs.python.org/tutorial/floatingpoint.html
More information about the Python-list