Skip to content

Commit 2c6d721

Browse files
bugfix for large args
1 parent 72cced1 commit 2c6d721

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/math/elementary/hyptrig.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function sinh(x::DoubleFloat{T}) where {T<:IEEEFloat}
2-
isinf(x) && return x
2+
HI(x) >= 709.0 && return DoubleFloat{T}(copysign(Inf, HI(x)))
33
x < 0 && return -sinh(-x)
44
iszero(x) && return zero(x)
55
!isfinite(x) && return nan(typeof(x))
@@ -10,7 +10,7 @@ function sinh(x::DoubleFloat{T}) where {T<:IEEEFloat}
1010
end
1111

1212
function cosh(x::DoubleFloat{T}) where {T<:IEEEFloat}
13-
isinf(x) && return abs(x)
13+
HI(abs(x)) >= 709.0 && return DoubleFloat{T}(Inf)
1414
x < 0 && return cosh(-x)
1515
iszero(x) && return one(x)
1616
!isfinite(x) && return nan(typeof(x))
@@ -21,7 +21,7 @@ function cosh(x::DoubleFloat{T}) where {T<:IEEEFloat}
2121
end
2222

2323
function tanh(x::DoubleFloat{T}) where {T<:IEEEFloat}
24-
isinf(x) && return copysign(one(DoubleFloat{T}), x)
24+
HI(abs(x)) >= 709.0 && return copysign(one(DoubleFloat{T}), x)
2525
return sinh(x) / cosh(x)
2626
end
2727
#=
@@ -37,16 +37,16 @@ end
3737
=#
3838

3939
function csch(x::DoubleFloat{T}) where {T<:IEEEFloat}
40-
isinf(x) && return copysign(zero(DoubleFloat{T}), x)
40+
HI(abs(x)) >= 709.0 && return copysign(zero(DoubleFloat{T}), x)
4141
return inv(sinh(x))
4242
end
4343

4444
function sech(x::DoubleFloat{T}) where {T<:IEEEFloat}
45-
isinf(x) && return zero(DoubleFloat{T})
45+
HI(abs(x)) >= 709.0 && return zero(DoubleFloat{T})
4646
return inv(cosh(x))
4747
end
4848

4949
function coth(x::DoubleFloat{T}) where {T<:IEEEFloat}
50-
isinf(x) && return copysign(one(DoubleFloat{T}), x)
50+
HI(abs(x)) >= 709.0 && return copysign(one(DoubleFloat{T}), x)
5151
return cosh(x) / sinh(x)
5252
end

0 commit comments

Comments
 (0)