Skip to content
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

Merged
merged 5 commits into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion spec/draft/design_topics/accuracy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ 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 a correctly rounded 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).

IEEE 754-2019 requires support for subnormal (a.k.a., denormal) numbers, which are useful for supporting gradual underflow. However, hardware support for subnormal numbers is not universal, and many platforms (e.g., accelerators) and compilers support toggling denormals-are-zero (DAZ) and/or flush-to-zero (FTZ) behavior to increase performance and to guard against timing attacks. Accordingly, conforming implementations may vary in their support for subnormal numbers.

Mathematical Functions
----------------------

The results of the following functions

- reciprocal
- sqrt

for real-valued floating-point operands must return a correctly rounded value according to IEEE 754-2019 and a supported rounding mode.

This specification does **not** precisely define the behavior of the following functions

- acos
Expand All @@ -41,10 +50,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
Expand Down Expand Up @@ -75,3 +86,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.