[issue1565] round(x,y) doesn't behave as expected, round error

2007-12-07 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Your function is not better: >>> print my_round(s,2) 1.41 >>> my_round(s,2) 1.4099 print uses str(), and restricts itself to 12 significant digits. the direct call uses repr(), and display the most precise number. The problem is not in the co

[issue1565] round(x,y) doesn't behave as expected, round error

2007-12-07 Thread Shlomo Anglister
Shlomo Anglister added the comment: >>> def my_round(n,i): ... t = n * (10**i) ... s = round(t) ... r = s / (10**i) ... return r ... >>> print my_round(s,2) 1.41 __ Tracker <[EMAIL PROTECTED]> ___

[issue1565] round(x,y) doesn't behave as expected, round error

2007-12-07 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Please see http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate -- nosy: +amaury.forgeotdarc resolution: -> invalid status: open -> closed __ Tracker <[EMAIL PROTECTED]>

[issue1565] round(x,y) doesn't behave as expected, round error

2007-12-07 Thread Shlomo Anglister
New submission from Shlomo Anglister: #Round is unexpectedly wrong >>> z = complex(1,1) >>> s=abs(z) >>> round(s,2) 1.4099 -- components: Interpreter Core messages: 58266 nosy: shlomoa severity: normal status: open title: round(x,y) doesn't behave as expected, round error ver