◐ Shell
clean mode source ↗

Message 106828 - Python tracker

The accumulated error doesn't need to exceed 1;  it just needs to be enough to make (e.g.) leftover appear to be >= 0.5 when it's actually just less than 0.5.  It shouldn't be too hard to find examples where this happens, but I haven't thought about it.

> I wonder if it would be justified to expose something like
> int _PyLong_IsOdd(PyObject *self) {...}

Yes, that could work.  I'd be happier with this if there are other uses (even within longobject.c);  there might well be, but I haven't looked.  I also have a mild preference for _PyLong_IsEven over _PyLong_IsOdd.  :)