-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
runtime: floating point error on arm64 #44528
Comments
This may be multiply-add optimizations. Try
and see if that changes anything. From the spec:
|
@randall77 you are right, this test passes: func TestMathTanh(t *testing.T) {
v := 0.2228940815087735
tanh := math.Tanh(v)
a := 1 - float64(tanh*tanh) + 1 - 1
b := 1 - float64(tanh*tanh) - 1 + 1
if a != b {
t.Fail()
}
} |
Anyway, I guess that the behavior should be the same on |
We do not guarantee identical floating-point behavior across architectures, as the spec describes. |
The spec mention that the behavior can differ accross different architecture. See golang/go#44528 for more details
* fix(tanhdiff): add explicit cast for tanh test The spec mention that the behavior can differ accross different architecture. See golang/go#44528 for more details * Update chewxy/math32 package to latest version This fixes most broken tests in arm64 * Fix TanhDiff test for arm64 * Fix Barzilai Borwein solver test for arm64 * Add some explanations for the floating-point precision issues Co-authored-by: Olivier Wulveryck <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
While debugging some tests for Gorgonia, we found this strange behavior:
This test is passing on amd64 and is failing on arm64.
What did you expect to see?
The test should pass
What did you see instead?
The test is failing
The text was updated successfully, but these errors were encountered: