Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
37566326
Commit
37566326
authored
Aug 14, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.23.x'
parents
46f684e5
3cf41e14
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
23 deletions
+75
-23
tests/run/addop.pyx
tests/run/addop.pyx
+3
-3
tests/run/cpdef_enums.pyx
tests/run/cpdef_enums.pyx
+16
-6
tests/run/future_division.pyx
tests/run/future_division.pyx
+27
-6
tests/run/non_future_division.pyx
tests/run/non_future_division.pyx
+27
-6
tests/run/subop.pyx
tests/run/subop.pyx
+2
-2
No files found.
tests/run/addop.pyx
View file @
37566326
...
...
@@ -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
...
...
tests/run/cpdef_enums.pyx
View file @
37566326
...
...
@@ -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
...
...
tests/run/future_division.pyx
View file @
37566326
...
...
@@ -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
...
...
tests/run/non_future_division.pyx
View file @
37566326
# 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
...
...
tests/run/subop.pyx
View file @
37566326
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment