File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 11import math
22import random
3+ import platform
34import sys
45import unittest
56import warnings
@@ -197,6 +198,10 @@ def test_pack_unpack_roundtrip_for_nans(self):
197198 # PyFloat_Pack/Unpack*() API. See also gh-130317 and
198199 # e.g. https://developercommunity.visualstudio.com/t/155064
199200 signaling = 0
201+ if platform .machine ().startswith ('parisc' ):
202+ # HP PA RISC uses 0 for quiet, see:
203+ # https://en.wikipedia.org/wiki/NaN#Encoding
204+ signaling = 1
200205 quiet = int (not signaling )
201206 if size == 8 :
202207 payload = random .randint (signaling , 0x7ffffffffffff )
Original file line number Diff line number Diff line change 55import math
66import operator
77import unittest
8+ import platform
89import struct
910import sys
1011import weakref
@@ -917,10 +918,17 @@ def test_half_float(self):
917918
918919 # Check that packing produces a bit pattern representing a quiet NaN:
919920 # all exponent bits and the msb of the fraction should all be 1.
921+ if platform .machine ().startswith ('parisc' ):
922+ # HP PA RISC uses 0 for quiet, see:
923+ # https://en.wikipedia.org/wiki/NaN#Encoding
924+ expected = 0x7c
925+ else :
926+ expected = 0x7e
927+
920928 packed = struct .pack ('<e' , math .nan )
921- self .assertEqual (packed [1 ] & 0x7e , 0x7e )
929+ self .assertEqual (packed [1 ] & 0x7e , expected )
922930 packed = struct .pack ('<e' , - math .nan )
923- self .assertEqual (packed [1 ] & 0x7e , 0x7e )
931+ self .assertEqual (packed [1 ] & 0x7e , expected )
924932
925933 # Checks for round-to-even behavior
926934 format_bits_float__rounding_list = [
You can’t perform that action at this time.
0 commit comments