Author mark.dickinson
Recipients lemburg, mark.dickinson, rhettinger, stutzbach, tim.peters, vstinner
Date 2020-01-10.20:03:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578686618.71.0.752599930292.issue39288@roundup.psfhosted.org>
In-reply-to
Content
I'm not opposed to some form of this by any means, but I fear there's some bikeshedding to go through, both on the name and the functionality (one function with two arguments, or two functions each taking a single argument?).

C 99 prescribes "nextafter" and "nexttoward" (which is pretty much the same as "nextafter" if you don't care about the distinction between float, double and long double).

IEEE 754, on the other hand, requires instead nextUp and nextDown, which take a single argument and move towards +inf or -inf (respectively).

Python's Decimal type has a two-argument next_toward method.

NumPy has nextafter.

Java provides all three of nextUp, nextDown and nextAfter.

For sure implementing nextafter is easiest, since we can just wrap the C version. That doesn't *necessarily* make it the right variant to go for.

(Annoyingly enough, none of these is actually what I tend to want in practice, which is "next larger" and "next smaller" functions, or more precisely, nextAwayFromZero and nextTowardsZero functions. nextTowardsZero is of course a special case of nextafter, but nextAwayFromZero doesn't match any of these.)
History
Date User Action Args
2020-01-10 20:03:38mark.dickinsonsetrecipients: + mark.dickinson, lemburg, tim.peters, rhettinger, vstinner, stutzbach
2020-01-10 20:03:38mark.dickinsonsetmessageid: <1578686618.71.0.752599930292.issue39288@roundup.psfhosted.org>
2020-01-10 20:03:38mark.dickinsonlinkissue39288 messages
2020-01-10 20:03:38mark.dickinsoncreate