-
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 hypot
specification for computing the square root of the sum of squares
#703
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, thanks @kgryte.
I plan to merge this soon unless there are more review comments.
I am a bit concerned about mentioning subnormal here. In CuPy we always set the compiler flag |
Q: I forgot what conclusion we had on this API, @kgryte do we plan to target v2023? |
@leofang I've added a note concerning subnormal behavior and the fact that actual hardware support may vary. Does this allay your concerns? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Great, looks like everyone is happy now - let's hit the green button. Thanks @kgryte & reviewers! |
This PR
hypot
#544 by adding a specification for computing the square root of the sum of squares.+-infinity
, the result is infinity, regardless of whether the other operand isNaN
. Intentionally, this deviates from a naivesqrt(x**2 + y**2)
implementation.sqrt
in requiring floating-point data types. The guidance uses "should", not "must", to allow implementations to support non-floating-point data types. The reason for the floating-point restriction is that the output data type must be a real-valued floating-point data type and promoting from, e.g., an integral to a floating-point data type is implementation-defined. For defined promotion semantics, a consumer should provide input arrays having floating-point data types.