-
Notifications
You must be signed in to change notification settings - Fork 53
Need for signbit in the array API spec #670
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
Comments
Yeah it is a bit clunky right now. In |
There is a proposal for copysign at #593. |
For an implementer to test something, it isn't required to use only functions in the standard. This is checking the value of a bit, which can be done with a private function even. Not saying that it's not a good idea to have this function - but especially given that JAX doesn't have it, it'd be nice to have a stronger reason. I checked the SciPy code base. There's a lot of use of the C/C++ versions of
Scikit-learn doesn't have any usage of
|
JAX does have signbit: https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.signbit.html |
Okay, that is two votes for adding signbit(x: array, /) -> array Let's add it? |
I can create a PR later this week. |
PR is up for review: gh-705 |
The array specification for
atan2
requires implementations to output-0.0
for some special values, e.g.which brings up a question on how implementors can distinguish between
-0.0
and+0.0
in their test suite.Equality testing spec mandates that these values be indistinguishable, and for a good reason.
The
sign
function also clamps these two values into+0.0
.I think this calls for the standard to have the
signbit
function:numpy.signbit
refcupy.signbit
reftorch.signbit
reftf.experimental.numpy.signbit
refdask.array.signbit
refsignbit
function, although it is implementable (example in one of JAX's issues)The text was updated successfully, but these errors were encountered: