[issue30453] str.format() method, Rounding off wrong

2017-05-25 Thread Kazuhiro Fujie
Kazuhiro Fujie added the comment: Hi, Mark Thank you for teaching politely. I had misunderstood about format() and round() functions. I made mistakes though I already knew about floating point. I think try to take this tactics on my codes. num1 = 4.625 num2 = 4.62501 num3 = 4.625001 nu

[issue30453] str.format() method, Rounding off wrong

2017-05-24 Thread Mark Dickinson
Mark Dickinson added the comment: > is exactly halfway between 4.2 and 4.3. That should have said "between 4.62 and 4.63", of course. Apologies. -- ___ Python tracker ___ __

[issue30453] str.format() method, Rounding off wrong

2017-05-24 Thread Mark Dickinson
Mark Dickinson added the comment: Actually, there are two potential sources of confusion here: 1. Python uses the round-ties-to-even rounding mode, which means cases that are *exactly* halfway between two target values round to the value with even last digit. This rule is being used in your fi

[issue30453] str.format() method, Rounding off wrong

2017-05-24 Thread Mark Dickinson
Mark Dickinson added the comment: The code is behaving correctly. The surprise is due to the internal binary representation of Python floats, and is related to the documentation note about `round` here: https://docs.python.org/3/library/functions.html#round > The behavior of round() for float

[issue30453] str.format() method, Rounding off wrong

2017-05-24 Thread Kazuhiro Fujie
New submission from Kazuhiro Fujie: To whom it may concern: I post issue at first time. Please forgive me if this is rude C:\Users\kudo-shunsaku>python Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for