]> Cypherpunks repositories - gostls13.git/commit
math: fix portable FMA when x*y < 0 and x*y == -z
authorMichael Munday <mike.munday@lowrisc.org>
Fri, 30 Jun 2023 23:01:26 +0000 (00:01 +0100)
committerKeith Randall <khr@golang.org>
Wed, 5 Jul 2023 22:05:30 +0000 (22:05 +0000)
commitc8dad424bf01df69af729845acc151a66b87d594
tree0423a6e2afa8c95460eb82c11af8aae841995f9b
parentcd6676126b7e663e6202e98e2f235fff20d5e858
math: fix portable FMA when x*y < 0 and x*y == -z

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.

Fixes #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>
src/math/all_test.go
src/math/fma.go