[Tutor] round() errors

Tim Peters tutor@python.org
Wed, 12 Sep 2001 16:53:30 -0400


[Christian Mascher]
> I don't understand some response from the round()-function. 
> ...
 
> >>> round(10*1.95583,2) 
> 19.559999999999999
> >>> round(20*1.95583,2)
> 39.119999999999997
> >>> a=20*1.95583
> >>> a
> 39.116599999999998
> >>> round(a,2)
> 39.119999999999997

Please read

    http://python.sourceforge.net/devel-docs/tut/node14.html

which discusses this specific issue (among others).

> ...
> Is there any reason?

Yes <wink>.