Skip to content

Commit 07d6c3d

Browse files
committed
make multiplication commutative
1 parent defb3b6 commit 07d6c3d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/math/ops/op_dddd_dd.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ end
2525
return hi, lo
2626
end
2727

28-
# Algorithm 12 from Tight and rigourous error bounds. relative error <= 5u²
28+
# Algorithm 10 from Tight and rigourous error bounds. relative error <= 7u²
2929
@inline function mul_dddd_dd(x::Tuple{T,T}, y::Tuple{T,T}) where T<:IEEEFloat
3030
xhi, xlo = x
3131
yhi, ylo = y
3232
hi, lo = two_prod(xhi, yhi)
33-
t = xlo * ylo
34-
t = fma(xhi, ylo, t)
35-
t = fma(xlo, yhi, t)
33+
t1 = xhi * ylo
34+
t2 = xlo * yhi
35+
t = t1 + t2
3636
t = lo + t
3737
hi, lo = two_hilo_sum(hi, t)
3838
return hi, lo

test/concrete_accuracy.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@test pi_accurate == DoubleFloat{Float64}(pi)
99

1010
@test abs(inv(inv(pi_accurate)) - pi_accurate) <= eps(LO(pi_accurate))
11-
@test abs(phi_accurate - (phi_accurate*phi_accurate - 1.0)) <= eps(LO(phi_accurate))
11+
@test abs(phi_accurate - (phi_accurate*phi_accurate - 1.0)) <= 3eps(LO(phi_accurate))
1212

1313
a = Base.TwicePrecision(3.0) / Base.TwicePrecision(7.0)
1414
b = Double64(3.0) / Double64(7.0)

0 commit comments

Comments
 (0)