-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for copysign
to the specification
#693
Conversation
Yes, because real-valued floating-point dtypes is all that's in C99.
If it's supported by all libraries, then it should be fine I think. I quickly checked NumPy, PyTorch and JAX, all three seem to support it. |
I see nothing wrong with "supporting" signed NaNs. In practice, I doubt libraries take care with having meaningful signs. Python The C EDIt: To be clear, the C macro is not just theoretical, a negative sign is actually typical EDIT2: But if anyone has a problem with supporting it on some hardware, then I guess can just add a note for that. |
@seberg To clarify, while
|
As this PR has been reviewed and discussed without objections, will go ahead and merge. Any subsequent revisions can be addressed in follow-up PRs... |
I'm curious, do you know if this is guaranteed by the language, or does it just happen to be true for all implementations? |
CPython ensures this and I am pretty sure even tests for it (I has once looked at simplifying the code responsible). I.e., IIRC, we can rely on Mark Dickinson to ensure this. |
This PR
copysign
function to the standard #593 by adding support for composing a floating-point value having the magnitude ofx1_i
and the sign ofx2_i
for each element inx1_i
.NaN
may be manipulated.Questions