On Mon, Sep 5, 2011 at 10:57 PM, xyz <xyzh...@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 > 1.2100000000000002 > > 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 Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list