Tim Peters <t...@python.org> added the comment:
GMP's mpz has 18 functions of this form. These are the 6 "ceiling" flavors: c_divmod c_div c_mod c_divmod_2exp c_div_2exp c_mod_2exp The suggestion here is for c_div. There are 6 more for floor rounding (with prefix "f_" instead of "c_"), and another 6 for truncation ("to-zero" rounding, with prefix "t_"). Curiously enough, there's no direct support for any form of "round to nearest". So that's where this ends ;-) I personally almost never use -(-x // y). Because it's a bit obscure, and in real life y is always known to be positive, so the nearly obvious (x + y - 1) // y works fine. ---------- nosy: +tim.peters _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46639> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com