diff -r 1abf4b2fda6d pure/lib/primitives.pure --- a/pure/lib/primitives.pure Thu Jul 22 23:44:50 2010 +0000 +++ b/pure/lib/primitives.pure Sun Jul 25 18:09:27 2010 +0200 @@ -1068,15 +1068,25 @@ extern double pow(double, double); namespace; -x::double^y::double = __C::pow x y; +x::double^y::double = impl x y with + // For any value of y (including NaN), if x is +1, 1.0 shall be + // returned. + impl x y = 1.0 if x == 1; + + // If x is -1, and y is ±Inf, 1.0 shall be returned. + impl x y = 1.0 if x == -1 && infp y; + + impl x y = __C::pow x y; +end; + x::int^y::int | x::bigint^y::bigint | x::int^y::bigint | -x::bigint^y::int = __C::pow (double x) (double y); +x::bigint^y::int = (double x) ^ (double y); x::double^y::int | -x::double^y::bigint = __C::pow x (double y); +x::double^y::bigint = x ^ (double y); x::int^y::double | -x::bigint^y::double = __C::pow (double x) y; +x::bigint^y::double = (double x) ^ y; /* Pointer arithmetic. We do this using bigints, so that the code is portable to 64 bit systems. */