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
Boxiang Sun
cython
Commits
259b3635
Commit
259b3635
authored
Mar 26, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extend PyLong optimisation tests for '%' operator
parent
0897f269
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
tests/run/modop.pyx
tests/run/modop.pyx
+79
-0
No files found.
tests/run/modop.pyx
View file @
259b3635
...
...
@@ -54,6 +54,10 @@ def mod_obj_10(int2):
8
>>> int(mod_obj_10(-2**25))
8
>>> int((-2**31-1) % 10)
1
>>> int(mod_obj_10(int(-2**31-1)))
1
>>> int((2**50) % 10)
4
>>> int(mod_obj_10(2**50))
...
...
@@ -62,6 +66,10 @@ def mod_obj_10(int2):
6
>>> int(mod_obj_10(-2**50))
6
>>> int((-2**63-1) % 10)
1
>>> int(mod_obj_10(-2**63-1))
1
>>> int((2**200) % 10)
6
>>> int(mod_obj_10(2**200))
...
...
@@ -75,6 +83,77 @@ def mod_obj_10(int2):
return
int1
def
mod_obj_17
(
int2
):
"""
>>> 0 % 17
0
>>> mod_obj_17(0)
0
>>> 1 % 17
1
>>> mod_obj_17(1)
1
>>> (-1) % 17
16
>>> mod_obj_17(-1)
16
>>> 9 % 17
9
>>> mod_obj_17(16)
16
>>> 17 % 17
0
>>> mod_obj_17(17)
0
>>> (-17) % 17
0
>>> mod_obj_17(-17)
0
>>> (-18) % 17
16
>>> mod_obj_17(-18)
16
>>> 10002 % 17
6
>>> mod_obj_17(10002)
6
>>> int((2**25) % 17)
2
>>> int(mod_obj_17(2**25))
2
>>> int((-2**25) % 17)
15
>>> int(mod_obj_17(-2**25))
15
>>> int((-2**31-1) % 17)
7
>>> int(mod_obj_17(int(-2**31-1)))
7
>>> int((2**50) % 17)
4
>>> int(mod_obj_17(2**50))
4
>>> int((-2**50) % 17)
13
>>> int(mod_obj_17(-2**50))
13
>>> int((-2**63-1) % 17)
7
>>> int(mod_obj_17(-2**63-1))
7
>>> int((2**200) % 17)
1
>>> int(mod_obj_17(2**200))
1
>>> int((-2**200) % 17)
16
>>> int(mod_obj_17(-2**200))
16
"""
int1
=
int2
%
17
return
int1
def
mod_obj_m2
(
int2
):
"""
>>> 0 % -2
...
...
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