]> granicus.if.org Git - python/commitdiff
test_math ulp computation was wrong on big-endian systems
authorMark Dickinson <dickinsm@gmail.com>
Sat, 17 Oct 2009 07:06:37 +0000 (07:06 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Sat, 17 Oct 2009 07:06:37 +0000 (07:06 +0000)
Lib/test/test_math.py

index 2f45a1ea3cdda30f0795a0a03f47f9168ad337f1..41c2f4fe47e5f067124b362f02d477de8278a2c4 100644 (file)
@@ -43,7 +43,7 @@ def to_ulps(x):
     where C doubles are represented in IEEE 754 binary64 format.
 
     """
-    n = struct.unpack('q', struct.pack('<d', x))[0]
+    n = struct.unpack('<q', struct.pack('<d', x))[0]
     if n < 0:
         n = ~(n+2**63)
     return n