Skip to content

Commit 75f798f

Browse files
pkofodKristofferC
authored andcommitted
Change from parametric T signature to Int32 in _ldexp_exp (#29401)
__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 #29400 .
1 parent 3b3a163 commit 75f798f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

base/special/hyperbolic.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
# software is freely granted, provided that this notice
1414
# is preserved.
1515
# ====================================================
16-
17-
_ldexp_exp(x::Float64, i::T) where T = ccall(("__ldexp_exp", libm), Float64, (Float64, T), x, i)
18-
_ldexp_exp(x::Float32, i::T) where T = ccall(("__ldexp_expf",libm), Float32, (Float32, T), x, i)
19-
_ldexp_exp(x::Real, i) = _ldexp_exp(float(x, i))
16+
_ldexp_exp(x::Float64, i::Int32) = ccall(("__ldexp_exp", libm), Float64, (Float64, Int32), x, i)
17+
_ldexp_exp(x::Float32, i::Int32) = ccall(("__ldexp_expf",libm), Float32, (Float32, Int32), x, i)
18+
_ldexp_exp(x::Real, i::Int32) = _ldexp_exp(float(x), i)
2019

2120
# Hyperbolic functions
2221
# sinh methods
@@ -76,7 +75,7 @@ function sinh(x::T) where T <: Union{Float32, Float64}
7675
end
7776
# in d)
7877
if absx < H_OVERFLOW_X(T)
79-
return h*T(2)*_ldexp_exp(absx, -1)
78+
return h*T(2)*_ldexp_exp(absx, Int32(-1))
8079
end
8180
# in e)
8281
return copysign(T(Inf), x)
@@ -129,7 +128,7 @@ function cosh(x::T) where T <: Union{Float32, Float64}
129128
end
130129
# in e)
131130
if absx < H_OVERFLOW_X(T)
132-
return _ldexp_exp(absx, -1)
131+
return _ldexp_exp(absx, Int32(-1))
133132
end
134133
# in f)
135134
return T(Inf)

0 commit comments

Comments
 (0)