Skip to content

Commit

Permalink
Change from parametric T signature to Int32 in _ldexp_exp
Browse files Browse the repository at this point in the history
__ldexp_exp(f) requires the second argument to be an Int32, so we might as well hard-code that here. It also seems that the old specification is actually not valid, or might have unexpected results, so we should just go with Int32, see JuliaLang#29400 .
  • Loading branch information
pkofod authored Sep 27, 2018
1 parent 8d5c109 commit b453a68
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions base/special/hyperbolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
# software is freely granted, provided that this notice
# is preserved.
# ====================================================

_ldexp_exp(x::Float64, i::T) where T = ccall(("__ldexp_exp", libm), Float64, (Float64, T), x, i)
_ldexp_exp(x::Float32, i::T) where T = ccall(("__ldexp_expf",libm), Float32, (Float32, T), x, i)
_ldexp_exp(x::Real, i) = _ldexp_exp(float(x, i))
_ldexp_exp(x::Float64, i::Int32) = ccall(("__ldexp_exp", libm), Float64, (Float64, Int32), x, i)
_ldexp_exp(x::Float32, i::Int32) = ccall(("__ldexp_expf",libm), Float32, (Float32, Int32), x, i)
_ldexp_exp(x::Real, i::Int32) = _ldexp_exp(float(x), i)

# Hyperbolic functions
# sinh methods
Expand Down Expand Up @@ -76,7 +75,7 @@ function sinh(x::T) where T <: Union{Float32, Float64}
end
# in d)
if absx < H_OVERFLOW_X(T)
return h*T(2)*_ldexp_exp(absx, -1)
return h*T(2)*_ldexp_exp(absx, Int32(-1))
end
# in e)
return copysign(T(Inf), x)
Expand Down Expand Up @@ -129,7 +128,7 @@ function cosh(x::T) where T <: Union{Float32, Float64}
end
# in e)
if absx < H_OVERFLOW_X(T)
return _ldexp_exp(absx, -1)
return _ldexp_exp(absx, Int32(-1))
end
# in f)
return T(Inf)
Expand Down

0 comments on commit b453a68

Please sign in to comment.