Mark Dickinson <dicki...@gmail.com> added the comment:

"nextafter" is fine with me. I just wanted to make sure that we'd considered 
the options, and weren't choosing nextafter simply because it's the easiest 
thing to implement.

[Victor]

> It mentions for example "If x== y, y (of the type x) shall be returned" and 
> "If x or y is NaN, a NaN shall be returned". It's good to know that it's 
> specified ;-)

Agreed; it would be good to make sure that we have tests for the behaviour 
matching the spec, particularly with respect to signed zeros: the first clause 
here implies nextafter(0.0, -0.0) is -0.0, while nextafter(-0.0, 0.0) is 0.0. 
I'd also recommend adding tests for nextafter(smallest_normal, 0.0), 
nextafter(largest_normal, inf), nextafter(inf, 0), and the like. 

The C standard isn't 100% clear on what nextafter(-0.0, inf) should be: it 
could be argued that the "next" representable float after -0.0 in the direction 
of infinity is 0.0. But IEEE 754 is explicit that nextUp(±0) is the smallest 
positive subnormal, and we should have a test for that, too.

Making the second argument optional sounds reasonable to me, but doesn't 
necessarily have to happen in the existing PR; we can always add that option 
later.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39288>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to