You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FMA calculates x*y+z. In the portable implementation of FMA if |x*y| is equal to |z| the sign bit of the result is set to the sign bit of x*y. If x*y is negative and z is positive this results in the incorrect result -0.
FMA is an intrinsic on some platforms. This issue only affects the portable implementation (hence the different results when calling FMA directly vs. indirectly).
The text was updated successfully, but these errors were encountered:
When x*y == -z the portable implementation of FMA copied the sign
bit from x*y into the result. This meant that when x*y == -z and
x*y < 0 the result was -0 which is incorrect.
Fixesgolang#61130.
Change-Id: Ib93a568b7bdb9031e2aedfa1bdfa9bddde90851d
Reviewed-on: https://go-review.googlesource.com/c/go/+/507376
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Michael Munday <mike.munday@lowrisc.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
What version of Go are you using (
go version
)?8b5fe59
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?linux-amd64
What did you do?
https://go.dev/play/p/KGZMg3ATQtx
What did you expect to see?
What did you see instead?
FMA calculates
x*y+z
. In the portable implementation of FMA if|x*y|
is equal to|z|
the sign bit of the result is set to the sign bit ofx*y
. Ifx*y
is negative andz
is positive this results in the incorrect result-0
.FMA is an intrinsic on some platforms. This issue only affects the portable implementation (hence the different results when calling FMA directly vs. indirectly).
The text was updated successfully, but these errors were encountered: