On Jan 18, 7:55 am, "J. Peng" <[EMAIL PROTECTED]> wrote: > hello, > > why this happened on my python? > > >>> a=3.9 > >>> a > > 3.8999999999999999 > > I wanted 3.9 but got 3.89................ > How to avoid it? thanks. > > this is my python version: > > >>> sys.version > > '2.3.4 (#1, Feb 6 2006, 10:38:46) \n[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)]'
>>> 3.9 3.8999999999999999 >>> 3.9 == 3.8999999999999999 True http://effbot.org/pyfaq/why-are-floating-point-calculations-so-inaccurate.htm -- http://mail.python.org/mailman/listinfo/python-list