On Fri, 7 Aug 2026, Richard Biener wrote:

> On Fri, Aug 7, 2026 at 9:31 AM Alexander Monakov <[email protected]> wrote:
> >
> >
> > On Wed, 5 Aug 2026, Roger Sayle wrote:
> >
> > > Likewise when x is NaN, 0.0 - x
> > > may change the payload, but -x is guaranteed not to.
> >
> > Not saying you should drop the condition in your patch, but do we care
> > about NaN payload propagation anywhere else? The HONOR_NANS et al. only
> > seem to cover presence/absence of NaNs, not observability of payloads.
> 
> I think we don't.  -x will still turn sNaN into qNaN?

It may not, negation can only change the sign bit. It's a good point,
0-x would quieten the input sNaN and raise FE_INVALID for a sNaN but not qNaN,
negation wouldn't.

As for payload propagation, IEEE754 recommends that computational operations
propagate one of the input NaNs. Therefore 0-x should just propagate payload
of x when it's a qNaN, just like -x. But, conversely, propagating the input
NaN can result in 0-x having the same sign as x, not the opposite (this is
what actually happens on amd64, subsd preserves the sign of a NaN).

Alexander

Reply via email to