[Cfp-interest 2332] "almost" and Quiet NaN

Fred J. Tydeman tydeman at tybor.com
Sun Jan 16 10:10:37 PST 2022


Operators where a quiet NaN raises no floating-point (FP) exceptions:
++, --, sizeof, unary +, unary -, unary &, unary !, (FP) or (_Bool) cast,
*, /, +, -, ==, !=, &&, ||, ?:, FP or _Bool type = nan, and comma op(,)

Operators where a quiet NaN raises floating-point invalid exception:
(integer or pointer) cast, <, <=, >, >=, integer or pointer type = nan

Functions that raise FP invalid for quiet NaN arguments:
ilogb(), llogb(), lrint(), llrint(), lround(), llround(), fromfp(),
ufromfp(), fromfpx(), ufromfpx(), fma(0,infinity,nan), iseqsig()

Taking the index entry for "arithmetic operators" as a definition:
 additive: +, -
 bitwise: (&, ^, | are not FP)
 increment and decrement: ++, --
 multiplicative: *, / (% is not FP)
 shift: (<<, >> are not FP)
 unary: ++, --, sizeof, +, -, &, ! (* and ~ are not FP)

Why is the word "almost" in:
5.2.4.2.2: #4: A quiet NaN propagates through almost every arithmetic
operation without raising a floating-point exception;


---
Fred J. Tydeman        Tydeman Consulting
tydeman at tybor.com      Testing, numerics, programming
+1 (702) 608-6093      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.



More information about the Cfp-interest mailing list