Commit e8f01d59 authored by Russ Cox's avatar Russ Cox

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 543c6d2e
......@@ -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)
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment