[cfp-interest 3739] Complex and 'any floating-point operator'

Fred J. Tydeman tydeman at tybor.com
Thu Nov 27 01:23:38 PST 2025


WG14 N3219 (C23), F.2.2, paragraph 6 has:

Recommended practice
Any floating-point operator or <math.h> function or macro with a signaling NaN input, unless
explicitly specified otherwise, raises an "invalid" floating-point exception.


My question is:  Since 'Any floating-point operator' is not qualified with 'real',
does that mean it applies to 'complex' operators?

Aside:  Paragraph 4 has: "Any operator or <math.h> function ..."
while paragraph 6 has: "Any floating-point operator or <math.h> function or macro..."
Seems inconsistent.

G.6.1 paragraph 5 has:
In subsequent subclauses in G.6 "NaN" refers to a quiet NaN. The behavior of signaling NaNs in
this annex is implementation-defined.

There is no mention of 'operator' in Annex G with respect to signaling NaN.

The question arose from:
bool b1 = CMPLXL( 1.L/3.L, LDBL_SNAN );  /* no FE_INVALID */
bool b2 = CMPLXL( LDBL_SNAN, 1.L/3.L ); /* yes FE_INVALID */

Where the generated code first checks the real part for non-zero
(in which case if never checks the imaginary part for non-zero;
thereby, never looking at the SNAN in the first case).



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



More information about the cfp-interest mailing list