Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41598>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to