This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.

Index Nav: Message Nav: [Date Index] [Subject Index] [Author Index] [Thread Index] [Date Prev] [Date Next] [Thread Prev] [Thread Next] [Raw text]

# Re: [PATCH] Optimize pow(x,0.0) = pow(1.0,y) = 1.0

• From: Andreas Schwab <schwab at suse dot de>
• To: Roger Sayle <roger at www dot eyesopen dot com>
• Cc: Andrew Pinski <apinski at apple dot com>, gcc-patches at gcc dot gnu dot org
• Date: Fri, 21 Feb 2003 17:41:06 +0100
• Subject: Re: [PATCH] Optimize pow(x,0.0) = pow(1.0,y) = 1.0
• References: <Pine.LNX.4.44.0302210249430.6992-100000@www.eyesopen.com>

```Roger Sayle <roger at www dot eyesopen dot com> writes:

|> On Thu, 20 Feb 2003, Andrew Pinski wrote:
|> > Did you know that pow(0.0, 0.0) != 1.0?
|>
|> I'm using as reference "IA-64 and Elementary Functions: Speed and
|> Precision", by Peter Markstein, HP Professional Books, 2000.
|>
|> Section 12.6, entitled "Computing the Power Function" begins with
|> the paragraph.
|>
|> 	To demonstrate the care needed for the power function, and
|> 	the many special cases required by C99 in an IEEE 754
|> 	implementation, we present a double precision power routine.
|> 	C99 requires the following results from the power function:
|>
|> 	pow(x,+-0) returns 1 for any x, even a NaN.
|> 	...
|> 	pow(+-0,y) raises the divide-by-zero exception and returns
|> 		+-Inf for y < 0 and an odd integer, or +Inf for
|> 		other y < 0.
|> 	pow(+-0,y) returns +-0 for y > 0 and an odd integer, or
|> 		+0 for other y > 0.
|>
|> I apologise that my reference is non-authorative.  Can someone
|> confirm the wording in the actual ISO C99 specification?

The C99 wording is slightly different, but equivalent.

Andreas.

--
Andreas Schwab, SuSE Labs, schwab at suse dot de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

Index Nav: Message Nav: [Date Index] [Subject Index] [Author Index] [Thread Index] [Date Prev] [Date Next] [Thread Prev] [Thread Next]