Skip to content

Commit 4dbb825

Browse files
replace expm1
1 parent 8295987 commit 4dbb825

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/math/elementary/explog.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ function calc_exp(a::DoubleFloat{T}) where {T<:IEEEFloat}
179179
return z
180180
end
181181

182+
#=
183+
this is inaccurate for e.g. x=1.0e-16
184+
the fix is to redesign it completely
185+
for the meanwhile -- we replace it
186+
182187
function expm1(a::DoubleFloat{T}) where {T<:IEEEFloat}
183188
isnan(a) && return a
184189
isinf(a) && return(signbit(a) ? zero(DoubleFloat{T}) : a)
@@ -192,6 +197,12 @@ function expm1(a::DoubleFloat{T}) where {T<:IEEEFloat}
192197
a*(u-1.0) / log(u)
193198
end
194199
end
200+
=#
201+
202+
function expm1(a::DoubleFloat{T}) where {T<:IEEEFloat}
203+
y = expm1( Float128(a) )
204+
DoubleFloat{T}(y)
205+
end
195206

196207
function exp2(a::DoubleFloat{T}) where {T<:IEEEFloat}
197208
isnan(a) && return a

0 commit comments

Comments
 (0)