Skip to content

Commit 34247f7

Browse files
committed
[LangRef] make consequences of NaN rules for pow(i) more explicit
1 parent bbb0dba commit 34247f7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/docs/LangRef.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16269,6 +16269,12 @@ Semantics:
1626916269
This function returns the first value raised to the second power with an
1627016270
unspecified sequence of rounding operations.
1627116271

16272+
Note that the `powi` function is unusual in that NaN inputs can lead to non-NaN
16273+
results, and this depends on the kind of NaN (quiet vs signaling). Due to how
16274+
:ref:`LLVM treats NaN values <floatnan>`, the function may non-deterministically
16275+
treat signaling NaNs as quiet NaNs. For example, `powi(QNaN, 0)` returns `1.0`,
16276+
and `pow(SNaN, 0)` may non-deterministically return `1.0` or a NaN.
16277+
1627216278
.. _t_llvm_sin:
1627316279

1627416280
'``llvm.sin.*``' Intrinsic
@@ -16831,6 +16837,12 @@ trapping or setting ``errno``.
1683116837
When specified with the fast-math-flag 'afn', the result may be approximated
1683216838
using a less accurate calculation.
1683316839

16840+
Note that the `pow` function is unusual in that NaN inputs can lead to non-NaN
16841+
results, and this depends on the kind of NaN (quiet vs signaling). Due to how
16842+
:ref:`LLVM treats NaN values <floatnan>`, the function may non-deterministically
16843+
treat signaling NaNs as quiet NaNs. For example, `pow(QNaN, 0.0)` returns `1.0`,
16844+
and `pow(SNaN, 0.0)` may non-deterministically return `1.0` or a NaN.
16845+
1683416846
.. _int_exp:
1683516847

1683616848
'``llvm.exp.*``' Intrinsic

0 commit comments

Comments
 (0)