[issue46639] Ceil division with math.ceildiv

Mark Dickinson report at bugs.python.org
Mon Feb 7 14:01:40 EST 2022


Mark Dickinson <dickinsm at gmail.com> added the comment:

> Couldn't math.ceildiv(x, y) be implemented as -(-x//y) in a type-agnostic fashion?

Ah, good point. Yes, that could work.

We'd have to decide what to do about Decimal if we took this approach, since the -(-x//y) trick doesn't work there. (Document the issue? Try to make things work for Decimal?)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46639>
_______________________________________


More information about the Python-bugs-list mailing list