This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients marco_ocram, mark.dickinson, rhettinger, ronaldoussoren, steven.daprano, stutzbach, veky
Date 2020-08-22.05:17:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1598073422.18.0.723164641361.issue41598@roundup.psfhosted.org>
In-reply-to
Content
Marco, it is better to give a description of the functionality required rather than a simplistic and incorrect implementation :-)

(Not that I am likely to provide a better implementation without a lot of study.)

Regardless of whether you or I agree with the decision to move to Banker's Rounding, that was done about a decade ago, and it matches decisions made by other languages such as Julia. Changing the default will break people's code and we do not do that lightly, or at all, without a very good reason.

As Tim Peters describes here:

https://mail.python.org/pipermail/python-dev/2008-January/075873.html

many older languages implemented rounding by "add half and chop", more because it was cheap than for its mathematical properties.

Are you satisfied that adding a rounding mode to the built-in `round` function is a better solution than a series of functions in the math module? If so, I will change the title to reflect that.

Vedran: I don't think the availability of different rounding modes will have any effect at all on whether or not people believe floats are real decimal numbers rather than binary floats. People already believe that. I think we are better off acknowledging that there are reasonable use-cases for different rounding modes even when using floats.

According to this:

https://www.gnu.org/software/libc/manual/html_node/Rounding.html

IEEE-754 only requires four rounding modes, defaulting to the same Banker's Rounding that Python uses. Wikipedia says there are five:

https://en.wikipedia.org/wiki/IEEE_754#Rounding_rules


Regardless of whether there are four or five, I see no technical reason why we couldn't offer the full set of eight used by the decimal module.
History
Date User Action Args
2020-08-22 05:17:02steven.dapranosetrecipients: + steven.daprano, rhettinger, ronaldoussoren, mark.dickinson, stutzbach, veky, marco_ocram
2020-08-22 05:17:02steven.dapranosetmessageid: <1598073422.18.0.723164641361.issue41598@roundup.psfhosted.org>
2020-08-22 05:17:02steven.dapranolinkissue41598 messages
2020-08-22 05:17:01steven.dapranocreate