Skip to content

Commit 765e5f1

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

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

llvm/docs/LangRef.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16269,6 +16269,13 @@ 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>` in non-constrained functions, the
16275+
function may non-deterministically treat signaling NaNs as quiet NaNs. For
16276+
example, `powi(QNaN, 0)` returns `1.0`, and `powi(SNaN, 0)` may
16277+
non-deterministically return `1.0` or a NaN.
16278+
1627216279
.. _t_llvm_sin:
1627316280

1627416281
'``llvm.sin.*``' Intrinsic
@@ -16831,6 +16838,13 @@ trapping or setting ``errno``.
1683116838
When specified with the fast-math-flag 'afn', the result may be approximated
1683216839
using a less accurate calculation.
1683316840

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

1683616850
'``llvm.exp.*``' Intrinsic

0 commit comments

Comments
 (0)