@@ -935,12 +935,14 @@ def test_half_float(self):
935
935
self .assertTrue (math .isnan (struct .unpack ('<e' , bits )[0 ]))
936
936
self .assertTrue (math .isnan (struct .unpack ('>e' , bits [::- 1 ])[0 ]))
937
937
938
- if sys .platform != 'win32' :
939
- # Check round-trip for NaN's:
940
- nan = struct .unpack ('<e' , bits )[0 ]
941
- self .assertEqual (struct .pack ('<e' , nan ), bits )
942
- nan = struct .unpack ('>e' , bits [::- 1 ])[0 ]
943
- self .assertEqual (struct .pack ('>e' , nan ), bits [::- 1 ])
938
+ # Check round-trip for NaN's:
939
+ if (sys .platform == 'win32'
940
+ and not (int .from_bytes (bits [::- 1 ]) & (1 << 9 ))):
941
+ continue # doesn't work for sNaN's here
942
+ nan = struct .unpack ('<e' , bits )[0 ]
943
+ self .assertEqual (struct .pack ('<e' , nan ), bits )
944
+ nan = struct .unpack ('>e' , bits [::- 1 ])[0 ]
945
+ self .assertEqual (struct .pack ('>e' , nan ), bits [::- 1 ])
944
946
945
947
# Check that packing produces a bit pattern representing a quiet NaN:
946
948
# all exponent bits and the msb of the fraction should all be 1.
0 commit comments