-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Float128 fma() subtly corrupts state on Windows #31
Comments
Is it correct for other values? Not sure if this is related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89459 |
After calling Since things work on Linux, I don't think this one is an upstream GCC issue. (I believe I'm using a fairly old GCC on Linux without trouble here.) |
ah, if it's breaking In that case, maybe we should just disable |
I'm really here for the trouble it gave me in #30 and the challenge of a level-1 puzzle to pin that down, so either of your suggestions LGTM. |
Maybe we just remove |
I have disabled |
Opinion? @static if Sys.iswindows()
const SPLITTER = 1 + Float128(2)^57
const THRESHOLD = Float128(2)^16326
function two_sum(x::Float128, y::Float128)
hi = x + y
a = hi - y
b = hi - a
lo = (x - a) + (y - b)
return hi, lo
end
function sum_three(x::Float128, y::Float128, z::Float128)
s, t = two_sum(y, z)
u, v = two_sum(x, s)
hi = t + v + u
return hi
end
function splitter(x::Float128)
x < THRESHOLD || throw(DomainError("Threshold $THRESHOLD exceeded"))
a = x * SPLITTER
b = x - a
x1 = a + b
x2 = x - x1
return x1, x2
end
function two_prod(x::Float128, y::Float128)
hi = x * y
x1, x2 = splitter(x)
y1, y2 = splitter(y)
lo = x2 * y2 - (((hi - x1*y1) - x1*y2) - x2*y1)
return hi, lo
end
function fma(x::Float128, y::Float128, z::Float128)
xyhi, xylo = two_prod(x, y)
result = sum_three(z, xyhi, xylo)
return result
end
end |
|
It's fine by me -- the more important aspect of this is let the Windows version work for clients who use |
Thought it worth the revisit
|
@JeffreySarnoff would you mind opening a pull request? Isn't |
|
Has this "On Windows (but not Linux or OSX) calls to fma() somehow break the overflow handling." fixed itself with the current libquadmath that we use? If so, we should remove the code that blocks fma on Windows. |
It appears to be unchanged for current and nightly Julia. The example at the top is included as a broken test for Windows in the commit shown here: |
On Windows (but not Linux or OSX) calls to
fma()
somehow break the overflow handling.I don't see anything wrong with our wrappers; it may be a libquadmath and/or libgcc issue.
The text was updated successfully, but these errors were encountered: