https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112449

--- Comment #5 from post+gcc at ralfj dot de ---
> See 
> https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fsignaling-nans

That's unrelated. That's about whether operation on signaling NaNs can trap. I
am asking when operations can output a signaling NaN.

So, for code like

float x = y <op> z;
return is_signaling_nan(x);

when can that code return `true`? Normal IEEE semantics would say "never". And
yet if "z" is the constant 1, <op> is `*`, and "y" is a signaling NaN, then
this evidently can output a signaling NaN.

I would hope the answer is "this can output a signaling NaN only if one of the
inputs is a signaling NaN", but is that documented anywhere?

> Note mips and sh and a few other targets have the quiet bit meaning the 
> opposite.

I know. LLVM is currently buggy on those targets.

> GCC does document some of this on 
> https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Floating-point-implementation.html
>  but not the signaling nan part.

This seems to list a bunch of implementation-defined aspects of C? To my
knowledge, my question is not implementation defined. C (with the annex for
floating-point arithmetic) requires the above operations to always return
"false". GCC violates the C spec here (since it defines __STDC_IEC_559__,
declaring support for the annex), and it'd be good to know how far it is going
in that violation.

Reply via email to