[Python-ideas] Round division
p.f.moore at gmail.com
Thu Sep 10 23:48:42 CEST 2015
On 10 September 2015 at 22:13, Mark Young <marky1991 at gmail.com> wrote:
> Pardon my ignorance, but what is the definition of round division? (if it
> isn't "round(a/b)")
I assumed it would be "what round(a/b) would give if it weren't
subject to weird floating point rounding issues". To put it another
way, if a / b is d remainder r, then I'd assume "round division" would
be d if r < b/2, d+1 if r > b/2, and (which of d, d+1?) if r == b/2.
(a, b, d and r are all integers).
If not, then I also would like to know what it means...
Either way, if it is introduced then it should be documented
(particularly as regards what happens when one or both of a, b are
negative) clearly, as it's not 100% obvious.
Also, is the math module the right place? All of the operations in the
math module (apart from factorial, for some reason...) are floating
More information about the Python-ideas