[cfp-interest 3420] sign bit of a NaN

Damian McGuckin damianm at esi.com.au
Fri Mar 28 19:18:58 PDT 2025


In looking at somebodies example, it was noticed that

 	const double nan = 0.0/0.0

delivers

 	-nan ... with gcc 11
 	+nan ,,, with clang 17

I know that the sign is irrelevant on a NaN but with something like 
cproj() whose sign of its imaginary component does depend on this,
one might get the wrong answer (alough not one which will compare as
different).

What should the above yield or is there not an answer to that question?

Note that

 	const double inf = 1.0/0.0

yields +INFINITY with both compilers.

Thanks - Damian


More information about the cfp-interest mailing list