This repository has been archived by the owner on Dec 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Dekker multiplication isn't exact #30
Comments
timholy
changed the title
Dekker multiplication doesn't handle subnormals
Dekker multiplication isn't exact
Aug 14, 2017
Here's another interesting case, one that doesn't involve subnormals: julia> x, y = Single(Float16(0.9775)), Single(Float16(0.5156))
(DoubleDouble.Single{Float16}(Float16(0.9775)), DoubleDouble.Single{Float16}(Float16(0.5156)))
julia> d = x*y
Double(0.5044, -0.0001068)
- value: 0.5042877197265625
julia> bits(widen(d.hi) + widen(d.lo))
"00111111000000010001100100000000"
julia> bits(widen(x.hi) * widen(y.hi))
"00111111000000010000100100000000" I thought this should satisfy the theorem that it should be exact? |
I think here's the origin of the trouble (referencing DoubleDouble.jl/src/DoubleDouble.jl Lines 141 to 145 in 67683c7
julia> bits(widen(hx)*widen(hy))
"00111111000000011111000000000000"
julia> bits(widen(hx*hy))
"00111111000000100000000000000000" Doesn't the algorithm assume that multiplication of the two hi terms is exact? |
Ah, the problem is that In any case, we should move to using |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I was surprised to discover this:
It can be fixed this way:
But given that many treatises say "it's exact unless the splitting overflows," this was a surprising discovery to me.
The text was updated successfully, but these errors were encountered: