[Cfp-interest 1840] Re: Negative zero

Damian McGuckin damianm at esi.com.au
Mon Nov 9 14:53:51 PST 2020


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


More information about the Cfp-interest mailing list