Skip to content

Commit f3bb543

Browse files
Merge pull request #244 from araujoms/main
refactor inv to remove duplicated code
2 parents 11d5489 + 8c0ed4c commit f3bb543

4 files changed

Lines changed: 11 additions & 101 deletions

File tree

src/DoubleFloats.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ include("Double.jl") # Double64, Double32, Double16
8585
include("math/errorfree.jl")
8686
include("math/leasterror.jl")
8787

88-
include("doubletriple/double.jl")
8988
include("doubletriple/double_consts.jl")
9089
include("doubletriple/triple.jl")
9190
include("doubletriple/triple_consts.jl")

src/doubletriple/double.jl

Lines changed: 0 additions & 88 deletions
This file was deleted.

src/math/ops/op_dd_dd.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
function inv_dd_dd(x::Tuple{T,T}) where {T<:IEEEFloat}
2-
return DWInvDW3(HI(x), LO(x))
1+
# inv using Algorithms 17 and 18 from Tight and rigorous error bounds
2+
3+
function inv_dd_dd(y::Tuple{T, T}) where {T<:IEEEFloat}
4+
yₕᵢ, yₗₒ = y
5+
tₕᵢ = inv(yₕᵢ)
6+
rₕᵢ = fma(yₕᵢ, -tₕᵢ, one(T))
7+
rₗₒ = -(yₗₒ * tₕᵢ)
8+
eₕᵢ, eₗₒ = two_hilo_sum(rₕᵢ, rₗₒ)
9+
dₕᵢ, dₗₒ = mul_ddfp_dd((eₕᵢ, eₗₒ), tₕᵢ)
10+
zₕᵢ, zₗₒ = add_ddfp_dd((dₕᵢ, dₗₒ), tₕᵢ)
11+
return zₕᵢ, zₗₒ
312
end
413

514
@inline function square_dd_dd(a::Tuple{T,T}) where {T<:IEEEFloat}

src/math/ops/op_ddfp_dd.jl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ end
1010
return hi, lo
1111
end
1212

13-
#=
14-
@inline function mul_ddfp_dd(x::Tuple{T,T}, y::T) where {T<:IEEEFloat}
15-
hi, lo = x
16-
hihi, hilo = two_prod(y, hi)
17-
lohi, lolo = two_prod(y, lo)
18-
hi, lo = two_sum(hihi, hilo, lohi, lolo)
19-
return hi, lo
20-
end
21-
=#
22-
2313
# Algorithm 12 from Tight and rigourous error bounds. relative error <= 5u²
2414
@inline function mul_ddfp_dd(x::Tuple{T,T}, y::T) where T<:IEEEFloat
2515
xhi, xlo = x

0 commit comments

Comments
 (0)