Skip to content

Commit 2cc7f47

Browse files
committed
add cutoff for integer conversion
1 parent b866168 commit 2cc7f47

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/math/elementary/explog.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ function Base.:(^)(r::DoubleFloat{T}, n::Int) where {T<:IEEEFloat}
120120
end
121121

122122
function Base.:(^)(r::DoubleFloat{T}, n::DoubleFloat{T}) where {T <: IEEEFloat}
123-
if isinteger(n)
124-
return r^Int64(Float64(n)) # convert n to Float64 first
123+
if isinteger(n) && n min(2^20, intmaxfloat(T, Int64))
124+
return r^Int64(n.hi)
125125
else
126126
return exp(n * log(r))
127127
end

0 commit comments

Comments
 (0)