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
4f8ba2bf
Commit
4f8ba2bf
authored
Mar 25, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for c division CEP 516
parent
0fdf2f78
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
tests/run/cdivision_CEP_516.pyx
tests/run/cdivision_CEP_516.pyx
+52
-0
No files found.
tests/run/cdivision_CEP_516.pyx
0 → 100644
View file @
4f8ba2bf
__doc__
=
u"""
>>> v = [(17, 10), (-17, 10), (-17, -10), (17, -10)]
>>> standard = [(a % b) for a, b in v]
>>> standard
[7, 3, -7, -3]
>>> [mod_int_py(a, b) for a, b in v] == standard
True
>>> [mod_short_py(a, b) for a, b in v] == standard
True
>>> [mod_float_py(a, b) for a, b in v] == standard
True
>>> [mod_double_py(a, b) for a, b in v] == standard
True
>>> [mod_int_c(a, b) for a, b in v]
[7, -7, -7, 7]
>>> [mod_float_c(a, b) for a, b in v]
[7.0, -7.0, -7.0, 7.0]
>>> [mod_double_c(a, b) for a, b in v]
[7.0, -7.0, -7.0, 7.0]
"""
cimport
cython
@
cython
.
cdivision
(
False
)
def
mod_int_py
(
int
a
,
int
b
):
return
a
%
b
@
cython
.
cdivision
(
False
)
def
mod_short_py
(
short
a
,
short
b
):
return
a
%
b
@
cython
.
cdivision
(
False
)
def
mod_double_py
(
double
a
,
double
b
):
return
a
%
b
@
cython
.
cdivision
(
False
)
def
mod_float_py
(
float
a
,
float
b
):
return
a
%
b
@
cython
.
cdivision
(
True
)
def
mod_int_c
(
int
a
,
int
b
):
return
a
%
b
@
cython
.
cdivision
(
True
)
def
mod_float_c
(
float
a
,
float
b
):
return
a
%
b
@
cython
.
cdivision
(
True
)
def
mod_double_c
(
double
a
,
double
b
):
return
a
%
b
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