mirror of
https://github.com/golang/go
synced 2024-11-06 20:16:11 -07:00
math: test portable FMA even on system with hardware FMA
This makes it a little less likely the portable FMA will be broken without realizing it. Change-Id: I7f7f4509b35160a9709f8b8a0e494c09ea6e410a Reviewed-on: https://go-review.googlesource.com/c/go/+/205337 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
543c6d2e0d
commit
e8f01d591f
@ -3053,12 +3053,18 @@ func TestYn(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
var PortableFMA = FMA // hide call from compiler intrinsic; falls back to portable code
|
||||
|
||||
func TestFMA(t *testing.T) {
|
||||
for _, c := range fmaC {
|
||||
got := FMA(c.x, c.y, c.z)
|
||||
if !alike(got, c.want) {
|
||||
t.Errorf("FMA(%g,%g,%g) == %g; want %g", c.x, c.y, c.z, got, c.want)
|
||||
}
|
||||
got = PortableFMA(c.x, c.y, c.z)
|
||||
if !alike(got, c.want) {
|
||||
t.Errorf("PortableFMA(%g,%g,%g) == %g; want %g", c.x, c.y, c.z, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user