[Cfp-interest 1850] Re: Negative zero
Jim Thomas
jaswthomas at sbcglobal.net
Sat Nov 21 11:49:26 PST 2020
In a recent post to STDS-754, Vincent Lefèvre wrote:
> I think that the terminology should be:
> * negative: equivalent to "less than zero", i.e. "< 0";
> * negative sign: can be used for any FP number; -0 has a negative
> sign, but NaN does not have a sign;
> * negative sign bit: can be used for any FP datum.
>
Do we agree with this interpretation of “negative”?
(I do, except for the last item. Do qNaN and sNaN data in an extended format necessarily have a sign bit? A sign bit pertains to encoding and 754 doesn’t specify an encoding for extended formats. I think this is a 754 issue.)
Does C require opposite-signed zeros to compare equal? Does Annex F say this explicitly? Annex F says it implicitly by reference to IEC 60559, so it should be editorial to say it explicitly in Annex F.
We might want to add a (foot)note to point out that negative zero and NaNs with a negative sign bit are not negative values.
Have we been careful enough about distinguishing the sign of a value and the bit sign of the representation? For example, 7.12.3.7 says
The signbit macro returns a nonzero value if and only if the sign of its argument value is negative.
Rabbit hole?
- Jim Thomas
> On Nov 9, 2020, at 2:53 PM, Damian McGuckin <damianm at esi.com.au> wrote:
>
>
> Fred,
>
> On Mon, 9 Nov 2020, Fred J. Tydeman wrote:
>
>> C in <math.h> 7.12.7.5 The pow functions has:
>> A domain error occurs if x is finite and negative
>> and y is finite and not an integer value.
>
> The IEEE 754 standard sats
>
> pow(+/-0, y) is +INFINITY and signals Divide by Zero for y<0 finite and not odd integral
>
> pow(+/-0, y) is +0.0 for y>0 finite and not an odd integer (and F.10.4.5 matches this)
>
>> Is -0.0 negative?
>> Is pow(-0.0, 1.5) a domain error?
>
> No. See the standard and F.10.4.5.
>
>> F.10.4.5
>> The pow functions has: pow(?0, y) returns +0 for y > 0 and not an odd integer.
>
>> Should "negative" be changed to "less than zero" in the above?
>
> I believe you are correct.
>
> BUT we have to add something to handle the case for x = -0.0 as special.
>
> I think the above is clear and complete. Apologies if I am did not nail it
>
> Regards - Damian
>
> Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
> Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
> Views & opinions here are mine and not those of any past or present employer
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20201121/d66c023c/attachment-0001.htm>
More information about the Cfp-interest
mailing list