openoffice-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Weir <robw...@apache.org>
Subject Re: Solving this 0⁰ issue correctly (was Re: Calc behavior: result of 0 ^ 0)
Date Wed, 20 Feb 2013 22:07:49 GMT
On Wed, Feb 20, 2013 at 4:37 PM, Dennis E. Hamilton <orcmid@apache.org> wrote:
> I earlier quoted the applicable (and only) texts from the Standards themselves, particularly
C++ and also the latest C Standard (2011 and C99 with all Technical Corrigenda through 2007).
>
> No matter what is said about pow(0,0) in the C99 Rationale v5.10 Appendix F of April
2003, there are no such requirements in the Standards, including those versions that have
been adopted since 2003.
>
>  - Dennis
>
> PS: I mentioned cpow(0,0) because of the mathematical relationship and I was observing
that is consistent with the subset that pow(x,y) supports.
>
> DETAILS
>
> The definition of domain error is that an implementation-defined value is returned *and*
errno is set to EDOM.  There is also the option of triggering a floating-point exception.
I assume that "capable of representation" *includes* silent NaN and +infinity but for all
I know those return with non-exception domain errors too.  Plauger certainly prepared to encounter
those in his implementation (though he also chose pow(0,0) = 1.0).
>
> The C 99 Rationale is not an ISO/IEC International Standard, regardless of the INCITS
J11 and SC22 WG14 participation.  It is not necessary to even know about it.  In particular,
>
>         "This Rationale discusses some language or library features which were not adopted
into the
> Standard. These are usually features which are popular in some C implementations, so
that a
> user of those implementations might question why they do not appear in the Standard."
[p.5 preceding section 0.1]  The Rationale doesn't address that question users might have.
>
>         "**[T]his rationale is not part of the Standard**" [bottom of page 5, their emphasis]
>
> Then there is Appendix F.  I have no idea what it means to have "normative" in the title.
 This appears to be an IEC 60559 floating-point profile from NCEC, with certain exceptions
to 60559, although not even that is entirely clear.  pow(+inf,0) = pow(0,0) = 1 are stated
as required under Appendix F (bottom of page 180)  Adding pow(NaN,0) = 1 (page 182) by taking
power(x,0)=1 as settled for all x is particularly marvelous.
>

In other words, C99, in a normative Annex F, section 9.4.4, for
implementations that conform to IEEE 754 floating point, says:

"pow(x, ±0) returns 1 for any x, even a NaN."

Do you see something different?

I'd like to make sure we're seeing the same thing here.

-Rob


> The developers of C 2011 also didn't seem to be under any compulsion with regard to the
C99 Rationale.
>
> -----Original Message-----
> From: Rob Weir [mailto:robweir@apache.org]
> Sent: Wednesday, February 20, 2013 10:14
> To: dev@openoffice.apache.org
> Subject: Re: Solving this 0⁰ issue correctly (was Re: Calc behavior: result of 0 ^
0)
>
> [ ... ] I'm reading a requirement for pow(x,0) to
> return 1 for all values of x.  Are you seeing something else?  Are you
> seeing anything that says a conforming C/C++ runtime may *return*
> something other than 1?
>
> Btw, the rationale for this choice is described on page 182 of this document:
>
> http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf
>
> [ ... ]
>

Mime
View raw message