Skip to content

Commit d9c5bcf

Browse files
committed
add inconsistent note
1 parent 1d50663 commit d9c5bcf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm/docs/LangRef.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16477,6 +16477,11 @@ Historically, libc returns NUM for NUM vs (sNaN or qNaN), and may return
1647716477
sNaN for qNaN vs sNaN. With the recent libc versions, libc follows IEEE754-2008:
1647816478
NUM vs sNaN -> qNaN; NUM vs qNaN -> NUM; qNaN vs sNaN -> qNaN; sNaN vs sNaN -> qNaN.
1647916479

16480+
Note that that arithmetic on an sNaN doesn't consistently produce a qNaN,
16481+
so arithmetic feeding into a minnum can produce inconsistent results.
16482+
Such as `fmin(sNaN+0.0, 1.0)` can produce qNaN or 1.0 depending on whether `+0.0`
16483+
is optimized out.
16484+
1648016485
If either operand is a qNaN, returns the other non-NaN operand. Returns
1648116486
NaN only if both operands are NaN or either operand is sNaN.
1648216487
If the operands compare equal, returns either one of the operands.
@@ -16529,6 +16534,11 @@ Historically, libc returns NUM for NUM vs (sNaN or qNaN), and may return
1652916534
sNaN for qNaN vs sNaN. With the recent libc versions, libc follows IEEE754-2008:
1653016535
NUM vs sNaN -> qNaN; NUM vs qNaN -> NUM; qNaN vs sNaN -> qNaN; sNaN vs sNaN -> qNaN.
1653116536

16537+
Note that that arithmetic on an sNaN doesn't consistently produce a qNaN,
16538+
so arithmetic feeding into a maxnum can produce inconsistent results.
16539+
Such as `fmax(sNaN+0.0, 1.0)` can produce qNaN or 1.0 depending on whether `+0.0`
16540+
is optimized out.
16541+
1653216542
If either operand is a NaN, returns the other non-NaN operand. Returns
1653316543
NaN only if both operands are NaN or either operand is sNaN.
1653416544
If the operands compare equal, returns either one of the operands.

0 commit comments

Comments
 (0)