Commit 3cf41e14 authored by Stefan Behnel's avatar Stefan Behnel

fix some tests on 32bit systems

parent a873979d
......@@ -79,15 +79,15 @@ def add_x_large(x):
1073741825.5
>>> add_x_large(-2.0**31)
-1073741824.0
>>> add_x_large(2**30 + 1)
>>> bigint(add_x_large(2**30 + 1))
2147483649
>>> bigint(2**50 + 1 + 2**30)
1125900980584449
>>> bigint(add_x_large(2**50 + 1))
1125900980584449
>>> 2**31 + 2**30
>>> bigint(2**31 + 2**30)
3221225472
>>> add_x_large(2**31)
>>> bigint(add_x_large(2**31))
3221225472
>>> bigint(2**66 + 2**30)
73786976295911948288
......
......@@ -5,20 +5,30 @@
Traceback (most recent call last):
NameError: ...name 'THOUSAND' is not defined
>>> TWO, THREE, FIVE
(2, 3, 5)
>>> TWO == 2 or TWO
True
>>> THREE == 3 or THREE
True
>>> FIVE == 5 or FIVE
True
>>> SEVEN # doctest: +ELLIPSIS
Traceback (most recent call last):
NameError: ...name 'SEVEN' is not defined
>>> FOUR, EIGHT
(4, 8)
>>> FOUR == 4 or FOUR
True
>>> EIGHT == 8 or EIGHT
True
>>> SIXTEEN # doctest: +ELLIPSIS
Traceback (most recent call last):
NameError: ...name 'SIXTEEN' is not defined
>>> RANK_0, RANK_1, RANK_2
(11, 37, 389)
>>> RANK_0 == 11 or RANK_0
True
>>> RANK_1 == 37 or RANK_1
True
>>> RANK_2 == 389 or RANK_2
True
>>> RANK_3 # doctest: +ELLIPSIS
Traceback (most recent call last):
NameError: ...name 'RANK_3' is not defined
......
......@@ -2,6 +2,12 @@ from __future__ import division
cimport cython
def bigints(values):
for x in values:
print(repr(x).rstrip('L'))
def doit(x,y):
"""
>>> doit(1,2)
......@@ -47,10 +53,20 @@ def py_mix(a):
(0.5, 0.0, 0.5, 0.0, 0.5, 0.0)
>>> 2**53 / 2.0
4503599627370496.0
>>> py_mix(2**53)
(4503599627370496.0, 4503599627370496, 4503599627370496.0, 4503599627370496.0, 4503599627370496.0, 4503599627370496)
>>> py_mix(2**53 + 1)
(4503599627370496.0, 4503599627370496, 4503599627370496.0, 4503599627370496.0, 4503599627370496.0, 4503599627370496)
>>> bigints(py_mix(2**53))
4503599627370496.0
4503599627370496
4503599627370496.0
4503599627370496.0
4503599627370496.0
4503599627370496
>>> bigints(py_mix(2**53 + 1))
4503599627370496.0
4503599627370496
4503599627370496.0
4503599627370496.0
4503599627370496.0
4503599627370496
>>> py_mix(2**53 + 1.0)
(4503599627370496.0, 4503599627370496.0, 4503599627370496.0, 4503599627370496.0, 4503599627370496.0, 4503599627370496.0)
"""
......@@ -65,8 +81,13 @@ def py_mix_by_neg1(a):
(1.0, 1, 1.0, 1.0, 1.0, 1)
>>> py_mix_by_neg1(int(2**31-1))
(-2147483647.0, -2147483647, -2147483647.0, -2147483647.0, -2147483647.0, -2147483647)
>>> py_mix_by_neg1(int(-2**31-1))
(2147483649.0, 2147483649, 2147483649.0, 2147483649.0, 2147483649.0, 2147483649)
>>> bigints(py_mix_by_neg1(int(-2**31-1)))
2147483649.0
2147483649
2147483649.0
2147483649.0
2147483649.0
2147483649
>>> results = py_mix_by_neg1(int(2**63-1))
>>> results[0] == results[2] == results[3] == results[4] == float(2**63-1) / -1.0 or results
True
......
# Py2.x mixed true-div/floor-div behaviour of '/' operator
def bigints(values):
for x in values:
print(repr(x).rstrip('L'))
def doit(x,y):
"""
>>> doit(1,2)
......@@ -45,10 +51,20 @@ def py_mix(a):
(0.5, 0.0, 0.5, 0.0, 0.5, 0.0)
>>> 2**53 / 2.0
4503599627370496.0
>>> py_mix(2**53)
(4503599627370496, 4503599627370496, 4503599627370496.0, 4503599627370496.0, 4503599627370496, 4503599627370496)
>>> py_mix(2**53 + 1)
(4503599627370496, 4503599627370496, 4503599627370496.0, 4503599627370496.0, 4503599627370496, 4503599627370496)
>>> bigints(py_mix(2**53))
4503599627370496
4503599627370496
4503599627370496.0
4503599627370496.0
4503599627370496
4503599627370496
>>> bigints(py_mix(2**53 + 1))
4503599627370496
4503599627370496
4503599627370496.0
4503599627370496.0
4503599627370496
4503599627370496
>>> py_mix(2**53 + 1.0)
(4503599627370496.0, 4503599627370496.0, 4503599627370496.0, 4503599627370496.0, 4503599627370496.0, 4503599627370496.0)
"""
......@@ -63,8 +79,13 @@ def py_mix_by_neg1(a):
(1, 1, 1.0, 1.0, 1, 1)
>>> py_mix_by_neg1(int(2**31-1))
(-2147483647, -2147483647, -2147483647.0, -2147483647.0, -2147483647, -2147483647)
>>> py_mix_by_neg1(int(-2**31-1))
(2147483649, 2147483649, 2147483649.0, 2147483649.0, 2147483649, 2147483649)
>>> bigints(py_mix_by_neg1(int(-2**31-1)))
2147483649
2147483649
2147483649.0
2147483649.0
2147483649
2147483649
>>> results = py_mix_by_neg1(int(2**63-1))
>>> results[2] == results[3] == float(2**63-1) / -1.0 or results
True
......
......@@ -175,9 +175,9 @@ def sub_large_x(x):
1073741823
>>> sub_large_x(2**30)
0
>>> 2**30 - 2**31
>>> bigint(2**30 - 2**31)
-1073741824
>>> sub_large_x(2**31)
>>> bigint(sub_large_x(2**31))
-1073741824
>>> sub_large_x(2.0**30)
0.0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment