Date: Wed, 09 Jun 1999 12:08:29 -0500 From: Eric Rudd Subject: Re: libm sources from cyberoptics To: Hans-Bernhard Broeker Cc: DJGPP-WORKERS Message-id: <375E9F8D.36DE4094@cyberoptics.com> Organization: CyberOptics MIME-version: 1.0 X-Mailer: Mozilla 4.05 [en] (Win95; U) Content-type: text/plain; charset=iso-8859-1 References: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id NAA03840 Reply-To: djgpp-workers AT delorie DOT com Hans-Bernhard Broeker wrote: > Therefore, this limit cannot possibly exist, and 0^0 cannot > be given any single, well-defined value. I agree entirely, and that's why I have pow(0., 0.) returning NaN with EDOM. > But on looking a bit deeper into the draft standard for C9x (not > 'the law' yet, but it's going to be), I find in Annex F.9.4.4: > > F.9.4.4 The pow functions > > [#1] > > -- pow(x, ±0) returns 1 for any x, even a NaN. > > Unlike some other Annexes, this one is 'normative', not just 'informative' > stuff. This implies that pow(0,0)==1, by word of the (coming) standard. (Sigh.) I (and several others) expressed reservations to Annex F in formal public comments on the committee draft. Some suggestions were accepted, but Annex F still specifies return values that (in my opinion) are mathematically indefensible. For instance, atan2(INF,INF) is specified to return +/- PI/4 or +/- 3*PI/4, depending on the signs of the infinities. This behavior is tantamount to agreeing that INF/INF = +/- 1. Also, pow(-2., INF) returns INF, based on the reasoning that infinity is an even integer. In my library, I followed the dictates of classical mathematics and C90. If the present Annex F survives in the C9x standard, I don't know what I'll do. -Eric Rudd