[issue39288] Add math.nextafter(a, b)

STINNER Victor report at bugs.python.org
Sat Jan 11 10:35:26 EST 2020


STINNER Victor <vstinner at python.org> added the comment:

PR 17937 is ready to be reviewed. The tests passed on the regular CIs and buildbots: good.

> That last assumes you want -0 and +0 to act differently

It is the case: I wrote an unit test checking exactly that, and it works as expected on all platforms (Windows, macOS, Linux, Intel, PPC, etc.).

> `nextafter()` is too widely implemented to fight against, despite the sucky name ;-)

nexttoward name is less ambiguous, but as you all said: "nextafter" name is way more popular. Honestly, it's not that hard to infer that the function can go "up" or "down" because it has a second parameter. If it's not obvious enough, maybe we can enhance the documentation.

--

About Wikipedia, the following articles are interesting for the ones like me who don't fully understand IEEE 754, rounding mode, etc.

* https://en.wikipedia.org/wiki/Unit_in_the_last_place
* https://en.wikipedia.org/wiki/Machine_epsilon
* https://en.wikipedia.org/wiki/IEEE_754

----------

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


More information about the Python-bugs-list mailing list