@@ -9,9 +9,20 @@ for f in (:sin, :cos, :tan, :asin, :acos, :acosh, :atanh, :log, :log2, :log10,
99 ($ f)(x:: Float64 ) = ccall (($ (string (f)),libm), Float64, (Float64,), x)
1010 ($ f)(x:: Float32 ) = ccall (($ (string (f," f" )),libm), Float32, (Float32,), x)
1111 ($ f)(x:: Real ) = ($ f)(float (x))
12+ if $ f != = :lgamma
13+ ($ f)(x) = (Base.$ f)(x)
14+ end
1215 end
1316end
1417
18+ for f in (:sqrt ,)
19+ @eval ($ f)(x) = (Base.$ f)(x)
20+ end
21+
22+ for f in (:max , :min )
23+ @eval ($ f)(x, y) = (Base.$ f)(x, y)
24+ end
25+
1526# Would be more efficient to remove the domain check in Base.sqrt(),
1627# but this doesn't seem easy to do.
1728sqrt (x:: T ) where {T<: AbstractFloat } = x < 0.0 ? T (NaN ) : Base. sqrt (x)
@@ -22,11 +33,13 @@ pow(x::Float64, y::Float64) = ccall((:pow,libm), Float64, (Float64,Float64), x,
2233pow (x:: Float32 , y:: Float32 ) = ccall ((:powf ,libm), Float32, (Float32,Float32), x, y)
2334# We `promote` first before converting to floating pointing numbers to ensure that
2435# e.g. `pow(::Float32, ::Int)` ends up calling `pow(::Float32, ::Float32)`
25- pow (x:: Number , y:: Number ) = pow (promote (x, y)... )
26- pow (x:: T , y:: T ) where {T<: Number } = pow (float (x), float (y))
36+ pow (x:: Real , y:: Real ) = pow (promote (x, y)... )
37+ pow (x:: T , y:: T ) where {T<: Real } = pow (float (x), float (y))
38+ pow (x, y) = ^ (x, y)
2739
2840# The following combinations are safe, so we can fall back to ^
2941pow (x:: Number , y:: Integer ) = x^ y
42+ pow (x:: Real , y:: Integer ) = x^ y
3043pow (x:: Complex , y:: Complex ) = x^ y
3144
3245"""
0 commit comments