[Cfp-interest 2335] Re: "almost" and Quiet NaN

Jim Thomas jaswthomas at sbcglobal.net
Sun Jan 16 15:02:38 PST 2022



> On Jan 16, 2022, at 10:10 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> 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;

Maybe I don’t understand the question, but 5.2.4.2.2 #4 refers to arithmetic operations, not arithmetic operators, and you mentioned arithmetic operations that do not propagate quiet NaNs and/or do raise a floating-point exception. (There are more functions, e.g. pow, that don’t alway propagate quiet NaNs.)

- Jim Thomas

> 
> 
> ---
> 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.
> 
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest




More information about the Cfp-interest mailing list