Hello,
repr(0.1) is '0.10000000000000001', in my Python 2.3.
From reading the article "Floating Point Arithmetic: Issues and
Limitations", I understand that it's the closest 17-digit decimal
representation of the binary floating-point number actually stored.
However, I don't understand why this should be what repr of floats
returns. repr should, if possible, return a string that evaluating it
will be == to the original object. But eval("0.1") obviously returns the
same floating point as 0.1 does! So why not make repr of floats return
the *shortest* decimal representation that will evaluate to the stored
binary number? Specifically, why not make repr(0.1) be "0.1"?
Thanks,
Noam Raphael