newbie floating point question

Tim Peters tim.one at comcast.net
Thu Feb 21 15:41:47 EST 2002


[Alex]
> Why does this happen ?
>
> >>> .2
> 0.20000000000000001
>
> Is this the correct behavior for the Python 2.2 interpreter ?

It's both correct and inexcusable, maddening and highly desirable.  The main
difference between Python and other languages you may have used here is that
Python isn't lying to you (well, it is, but not as badly as most others):

    http://www.python.org/doc/current/tut/node14.html





More information about the Python-list mailing list