[issue32956] python 3 round bug

2018-09-28 Thread Nathaniel Smith
Change by Nathaniel Smith : -- nosy: -njs ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue32956] python 3 round bug

2018-09-28 Thread Mark Dickinson
Mark Dickinson added the comment: > This change was advertised in the "What’s New In Python 3.0" document. Not originally, it wasn't. That information was added later, by me. :-) [1] In any case, I wasn't referring to documentation. I meant "silent" in the runtime-sense: there was no run-time

[issue32956] python 3 round bug

2018-09-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > the silent and subtle change in behaviour from Python 2 to Python 3 was a bit > unpleasant, and a possible source of late-discovered (or undiscovered) bugs. This change was advertised in the "What’s New In Python 3.0" document. https://docs.python.org/3/

[issue32956] python 3 round bug

2018-09-27 Thread Mark Dickinson
Mark Dickinson added the comment: [Joshua] > 1. Update the round() docs to make the documentation of this behavior less > buried, Sounds reasonable to me; I'm definitely open to documentation improvements. Though it doesn't seem all that buried to me: the round-ties-to-even behaviour is de

[issue32956] python 3 round bug

2018-09-26 Thread Nathaniel Smith
Nathaniel Smith added the comment: FWIW, I hadn't noticed this change in py3, but it would never have occurred to me that it's controversial... I thought everyone who'd studied the issue agreed that round-half-to-even was the best default :-). Numpy has always done round-to-even, and it's th

[issue32956] python 3 round bug

2018-09-26 Thread Joshua Bronson
Joshua Bronson added the comment: I spent a few minutes with git blame/checkout/show and so far have found https://bugs.python.org/issue1869 (via https://github.com/python/cpython/commit/e6a076d). Still reading -- looks like there were a number of different changes made to round() at the sam

[issue32956] python 3 round bug

2018-09-26 Thread Joshua Bronson
Joshua Bronson added the comment: Thanks, Mark. Yes, I saw where Tim said round-half-even should be the default, but I didn't see any proposal to expose it as e.g. math.round_half_even() instead, nor a more complete look at what other languages do. That, along with the subject being 2.6 and

[issue32956] python 3 round bug

2018-09-26 Thread Mark Dickinson
Mark Dickinson added the comment: Adding Tim Peters to the nosy list, so that he can tell me that I'm misrepresenting him ... -- nosy: +tim.peters ___ Python tracker ___

[issue32956] python 3 round bug

2018-09-26 Thread Mark Dickinson
Mark Dickinson added the comment: @jab: Did you see this message from the thread that Serhiy pointed to? https://mail.python.org/pipermail/python-dev/2008-January/075910.html Here's the sound bite version, but see the message for context: [Guido] > Wow. Do you have an opinion as to whether w

[issue32956] python 3 round bug

2018-09-26 Thread STINNER Victor
STINNER Victor added the comment: Rounding floating point numbers is a complex topic :-) Here are my notes on that topic: https://vstinner.readthedocs.io/misc.html#rounding It took me years to fix how Python rounds timestamps :-) -- nosy: +vstinner __

[issue32956] python 3 round bug

2018-09-26 Thread Joshua Bronson
Joshua Bronson added the comment: Thanks Serhiy, I read the Python-Dev thread you linked to, but that doesn't resolve the issues: - Its topic is Python 2.6 (where this behavior does not occur) rather than Python 3 (where it does). - A few messages into the thread Guido does address Python 3

[issue32956] python 3 round bug

2018-09-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See the discussion on the Python-Dev mailing list: https://mail.python.org/pipermail/python-dev/2008-January/075863.html. For C look at the rint() function. It is a common knowledge that rounding half-to-even is what users want in most cases, but it is a t

[issue32956] python 3 round bug

2018-09-24 Thread Ezio Melotti
Change by Ezio Melotti : -- nosy: +ezio.melotti, mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

[issue32956] python 3 round bug

2018-09-24 Thread Joshua Bronson
Joshua Bronson added the comment: This was so surprising to me that I had to check some other languages that I had handy. It turns out that not one of JavaScript, Ruby, Perl, C++, Java, Go, or Rust agrees with Python. In fact they all agreed with one another that 2.5 should round to 3. Examp

[issue32956] python 3 round bug

2018-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It works as documented. """ For the built-in types supporting round(), values are rounded to the closest multiple of 10 to the power minus ndigits; if two multiples are equally close, rounding is done toward the even choice (so, for example, both round(0.5)

[issue32956] python 3 round bug

2018-02-26 Thread M Hsia
M Hsia added the comment: import sys print(sys.version) for i in range(10): test=i+0.5 print (test,round(test,0)) 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] 0.5 0.0 1.5 2.0 2.5 2.0 3.5 4.0 4.5 4.0 5.5 6.0 6.5 6.0 7.5 8.0 8.5 8

[issue32956] python 3 round bug

2018-02-26 Thread M Hsia
New submission from M Hsia : import sys print(sys.version) for i in range(10): test=i+0.5 print (test,round(test,0)) 3.6.3 |Anaconda custom (64-bit)| (default, Nov 8 2017, 15:10:56) [MSC v.1900 64 bit (AMD64)] 0.5 0.0 1.5 2.0 2.5 2.0 3.5 4.0 4.5 4.0 5.5 6.0