Hello, On Tue, 20 Sep 2022, Aldy Hernandez wrote:
> > FWIW, in IEEE, 'abs' (like 'copy, 'copysign' and 'negate') are not > > arithmetic, they are quiet-computational. Hence they don't rise > > anything, not even for sNaNs; they copy the input bits and appropriately > > modify the bit pattern according to the specification (i.e. fiddle the > > sign bit). > > > > That also means that a predicate like negative_p(x) that would be > > implemented ala > > > > copysign(1.0, x) < 0.0 > > I suppose this means -0.0 is not considered negative, It would be considered negative if the predicate is implemented like above: copysign(1.0, -0.0) == -1.0 But really, that depends on what _our_ definition of negative_p is supposed to be. I think the most reasonable definition is indeed similar to above, which in turn is equivalent to simply looking at the sign bit (which is what copysign() does), i.e. ... > though it has > the signbit set? FWIW, on real_value's real_isneg() returns true for > -0.0 because it only looks at the sign. ... this seems the sensible thing. I just wanted to argue the case that set_negative (or the like) which "sets" the sign bit does not make the nan-ness go away. They are orthogonal. > > deal with NaNs just fine and is required to correctly capture the sign of > > 'x'. If frange::set_nonnegative is supposed to be used in such contexts > > (and I think it's a good idea if that were the case), then set_nonnegative > > does _not_ imply no-NaN. > > > > In particular I would assume that, given an VAYRING frange FR, that > > FR.set_nonnegative() would result in an frange {[+0.0,+inf],+nan} . > > That was my understanding as well, and what my original patch did. > But again, I'm just the messenger. Ah, I obviously haven't followed the thread carefully then. If that's what it was doing then IMO it was the right thing. Ciao, Michael.