[issue17259] Document round half to even rule for floats

2019-04-13 Thread Cheryl Sabella
Cheryl Sabella added the comment: It doesn't seem there have been other bugs reported related to this. However, if it's still agreed that the documentation should be clarified, I think a link from `locale.format_string()` (note, format() has been deprecated, hence the change in the name) to

[issue17259] Document round half to even rule for floats

2013-12-14 Thread Mark Dickinson
Mark Dickinson added the comment: And the Python 2 behaviour has been essentially unchanged for a long time: Python 2.4.6 (#1, Nov 7 2013, 16:01:20) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> "%.f

[issue17259] Document round half to even rule for floats

2013-12-14 Thread Mark Dickinson
Mark Dickinson added the comment: > From what I read in the thread it seems to be more like a bug rather than > something to just be documented, right? No, both round and formatting are working as expected: it's just a bit unfortunate that they use different rounding modes in 2.x. It's not som

[issue17259] Document round half to even rule for floats

2013-12-08 Thread alexd2
alexd2 added the comment: Note: I have python2.7.3 in Ubuntu 12.04.3 installed in a VirtualBox VM on a Windows 7 32-bit and an Intel(R) Core(TM)2 Duo CPU U9300 @ 1.20GHz (2 CPUs), ~1.2GHz processor -- ___ Python tracker

[issue17259] Document round half to even rule for floats

2013-12-08 Thread alexd2
alexd2 added the comment: I encountered the same inconsistent behavior. That is, I don't get the same rounding from the two following commands: print "%.f %.f" %(0.5, 1.5) # Gives --> 0 2 print "%.f %.f" %(round(0.5), round(1.5)) # Gives --> 1 2 I also get: print round(0.5), roun

[issue17259] Document round half to even rule for floats

2013-02-23 Thread Eric V. Smith
Eric V. Smith added the comment: I've just looked through the code for 2.7. It uses short float repr for both %-formatting and for float.__format__. So they both use Gay's code, and both should work the same as they do in 3.2+. In all cases, round-half-to-even is used. It's 2.6 that uses the

[issue17259] Document round half to even rule for floats

2013-02-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: When I wrote my previous message, I was reading the link above and did not notice that it want to the old 2.7 docs. The 3.x entry is fine. Perhaps 6.1.3.1. Format Specification Mini-Language could end with Rounding of floats is the same as for round(). under

[issue17259] Document round half to even rule for floats

2013-02-22 Thread Mark Dickinson
Mark Dickinson added the comment: Bah. Ignore me; I don't know what I'm talking about. Old-style formatting does round-half-to-even, too. -- ___ Python tracker ___ __

[issue17259] Document round half to even rule for floats

2013-02-22 Thread Mark Dickinson
Mark Dickinson added the comment: Indeed, in Python 3, round and new-style string formatting both do round-ties-to-even, by design. Old-style formatting does whatever the underlying OS does, which is typically round-half-away-from-zero. Python 2 is a bit more of a mess: in 2.7, new-style for

[issue17259] Document round half to even rule for floats

2013-02-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: -serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

[issue17259] Document round half to even rule for floats

2013-02-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: '%.0f' % 5.5, etc, does the same. I agree that consistent 3.x half to even is both correct and and in need of better doc to avoid repeated questions and invalid bug reports. -- nosy: +terry.reedy title: locale.format() rounding is not reliable for floa