This is the mail archive of the mailing list for the GCC project.

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

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

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 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: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]