-
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
docs: clarify that sqrt
must be correctly rounded in accordance with IEEE 754
#882
Open
kgryte
wants to merge
1
commit into
data-apis:main
Choose a base branch
from
kgryte:feat/sqrt-accuracy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,11 +23,18 @@ including the corresponding element-wise array APIs defined in this standard | |
- multiply | ||
- divide | ||
|
||
for floating-point operands must return the nearest representable value according to IEEE 754-2019 and a supported rounding mode. By default, the rounding mode should be ``roundTiesToEven`` (i.e., round to nearest with ties rounded toward the nearest value with an even least significant bit). | ||
for real-valued floating-point operands must return the nearest representable value according to IEEE 754-2019 and a supported rounding mode. By default, the rounding mode should be ``roundTiesToEven`` (i.e., round to nearest with ties rounded toward the nearest value with an even least significant bit). | ||
|
||
Mathematical Functions | ||
---------------------- | ||
|
||
The results of the following functions | ||
|
||
- reciprocal | ||
- sqrt | ||
|
||
for real-valued floating-point operands must return the nearest representable value according to IEEE 754-2019 and a supported rounding mode. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest changing |
||
|
||
This specification does **not** precisely define the behavior of the following functions | ||
|
||
- acos | ||
|
@@ -41,10 +48,12 @@ This specification does **not** precisely define the behavior of the following f | |
- cosh | ||
- exp | ||
- expm1 | ||
- hypot | ||
- log | ||
- log1p | ||
- log2 | ||
- log10 | ||
- logaddexp | ||
- pow | ||
- sin | ||
- sinh | ||
|
@@ -75,3 +84,8 @@ Linear Algebra | |
-------------- | ||
|
||
This specification does not specify accuracy requirements for linear algebra functions; however, this specification does expect that a conforming implementation of the array API standard will make a best-effort attempt to ensure that its implementations are theoretically sound and numerically robust. | ||
|
||
Operations Involving Complex Numbers | ||
------------------------------------ | ||
|
||
This specification does not specify accuracy requirements for arithmetic or functional operations involving complex-valued floating-point operands; however, this specification does expect that a conforming implementation of the array API standard will make a best-effort attempt to ensure that its implementations are theoretically sound and numerically robust. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I suggest changing
nearest representable
tocorrectly rounded
.If the rounding mode is not
roundTiesToEven
the value will be correctly rounded, but in general, it will not be the nearest representable. For example, if the rounding mode isroundTowardPositive
, then the correctly rounded value is rounded up regardless of whether the rounded down value is nearer to the infinitely precise mathematical result.