aboutsummaryrefslogtreecommitdiff
path: root/src/reflect/all_test.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-09-07 16:24:49 -0700
committerKeith Randall <khr@golang.org>2021-09-08 00:34:17 +0000
commitbab79dd3627a9c5d4b43ac3f3c2eba4a1f04b813 (patch)
tree3ff463b90947b22e7a2c6de600c766cca8bfdf42 /src/reflect/all_test.go
parent963218cc9c331931c5886f2eb7199e6d0c362e93 (diff)
downloadgo-bab79dd3627a9c5d4b43ac3f3c2eba4a1f04b813.tar.gz
go-bab79dd3627a9c5d4b43ac3f3c2eba4a1f04b813.zip
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>
Diffstat (limited to 'src/reflect/all_test.go')
-rw-r--r--src/reflect/all_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go
index eb3ddcb3e4..293d036f67 100644
--- a/src/reflect/all_test.go
+++ b/src/reflect/all_test.go
@@ -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)))