floating point woes

Grant Edwards invalid at invalid.invalid
Tue Feb 15 23:07:34 EST 2011


On 2011-02-16, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Tue, Feb 15, 2011 at 4:49 PM, Hans-Peter Jansen <hpj at urpla.net> wrote:
>>
>> while I usually cope with the woes of floating point issues, this is
>> one, that I didn't expect:
>>
>>>>> round(2.385, 2)
>> 2.3799999999999999
>>
>> Doesn't the docs say, it's rounded up for this case?
[...]

> Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> 2.385
> 2.3849999999999998
>
> Looks to me like it's working as expected...

Well, it's working as it's supposed to...

Whether it's working as expected depends on the user. :)

-- 
Grant






More information about the Python-list mailing list