[Tutor] list output -- float output

A.T.Hofkamp a.t.hofkamp at tue.nl
Fri Nov 14 13:04:49 CET 2008


spir wrote:
> # By the way, I do not understand at all the behaviour of repr on 
> rounded floats:
> x = round(1.1,1)
> print x, repr(x), "%s" %x
> 1.1 1.1000000000000001 1.1

This is a FAQ question:

http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate

Sincerely,
Albert




More information about the Tutor mailing list