reflect: add back signaling NaN test

I was a little too agressive in CL 258957 (removing 387 support) in
removing a signaling NaN test that should probably still exist.
I should have just removed the 387 skip, not the entire test.

Change-Id: I97ca53f190eb0de00e43b96629b2cae677e7dacb
Reviewed-on: https://go-review.googlesource.com/c/go/+/348209
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Keith Randall 2021-09-07 16:24:49 -07:00
parent 963218cc9c
commit bab79dd362

View file

@ -4431,6 +4431,14 @@ var gFloat32 float32
const snan uint32 = 0x7f800001
func TestConvertNaNs(t *testing.T) {
// Test to see if a store followed by a load of a signaling NaN
// maintains the signaling bit. (This used to fail on the 387 port.)
gFloat32 = math.Float32frombits(snan)
runtime.Gosched() // make sure we don't optimize the store/load away
if got := math.Float32bits(gFloat32); got != snan {
t.Errorf("store/load of sNaN not faithful, got %x want %x", got, snan)
}
// Test reflect's conversion between float32s. See issue 36400.
type myFloat32 float32
x := V(myFloat32(math.Float32frombits(snan)))
y := x.Convert(TypeOf(float32(0)))