[issue7010] Rounding when converting float tuple to str

2009-09-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: You're seeing the difference between str(.1) and repr(.1). When printing the tuple, you're getting the str of the tuple but just the repr of its contents ('%.17g'). When printing the number directly, you're just getting the str of the number which is round

[issue7010] Rounding when converting float tuple to str

2009-09-28 Thread Per Rosengren
Per Rosengren added the comment: I tried Python 3.1, and it does indeed not have this issue. Thanks for swift response! -- ___ Python tracker ___ ___

[issue7010] Rounding when converting float tuple to str

2009-09-28 Thread Mark Dickinson
Mark Dickinson added the comment: And as Eric says, you shouldn't see this behaviour in Python 3.1, since there str(0.1) == repr(0.1) == '0.1'. If you are seeing it in 3.1, then something interesting's happening: please reopen in that case. :) -- _

[issue7010] Rounding when converting float tuple to str

2009-09-28 Thread Mark Dickinson
Changes by Mark Dickinson : -- resolution: -> invalid status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue7010] Rounding when converting float tuple to str

2009-09-28 Thread Mark Dickinson
Mark Dickinson added the comment: This is expected (and correct) behaviour for Python 2.x and 3.0. Note that the first example calls .1.__str__, while the second calls .1.__repr__. Python 2.6.2 (r262:71600, Aug 26 2009, 09:40:44) [GCC 4.2.1 (SUSE Linux)] on linux2 Type "help", "copyright", "cr

[issue7010] Rounding when converting float tuple to str

2009-09-28 Thread Eric Smith
Eric Smith added the comment: What OS, processor, and Python version are you running this code on? >From your example, it's Python 3.x. 3.1 has a completely rewritten float->decimal conversion system, and I get different results. >>> print(.1) 0.1 >>> print((.1,)) (0.1,) >>> For 2.6 and 3.0,

[issue7010] Rounding when converting float tuple to str

2009-09-28 Thread Per Rosengren
New submission from Per Rosengren : When a floating point value is stored, the actual value stored is something at most some small number eps larger or smaller than the original value. Python knows this, so if it stores 0.1, and then prints the stored value, it rounds off decimals less signifi