Skip to content

Commit bab79dd

Browse files
committed
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 <[email protected]> Run-TryBot: Keith Randall <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 963218c commit bab79dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/reflect/all_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4431,6 +4431,14 @@ var gFloat32 float32
44314431
const snan uint32 = 0x7f800001
44324432

44334433
func TestConvertNaNs(t *testing.T) {
4434+
// Test to see if a store followed by a load of a signaling NaN
4435+
// maintains the signaling bit. (This used to fail on the 387 port.)
4436+
gFloat32 = math.Float32frombits(snan)
4437+
runtime.Gosched() // make sure we don't optimize the store/load away
4438+
if got := math.Float32bits(gFloat32); got != snan {
4439+
t.Errorf("store/load of sNaN not faithful, got %x want %x", got, snan)
4440+
}
4441+
// Test reflect's conversion between float32s. See issue 36400.
44344442
type myFloat32 float32
44354443
x := V(myFloat32(math.Float32frombits(snan)))
44364444
y := x.Convert(TypeOf(float32(0)))

0 commit comments

Comments
 (0)