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
Kirill Smelkov
cython
Commits
0c62e665
Commit
0c62e665
authored
Dec 01, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #456 from molpopgen/cpp_limits
Cpp limits
parents
10ef1409
3e17fd41
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
0 deletions
+77
-0
Cython/Includes/libcpp/limits.pxd
Cython/Includes/libcpp/limits.pxd
+61
-0
tests/run/libcpp_all.pyx
tests/run/libcpp_all.pyx
+16
-0
No files found.
Cython/Includes/libcpp/limits.pxd
0 → 100644
View file @
0c62e665
cdef
extern
from
"limits"
namespace
"std"
nogil
:
enum
float_round_style
:
round_indeterminate
=
-
1
round_toward_zero
=
0
round_to_nearest
=
1
round_toward_infinity
=
2
round_toward_neg_infinity
=
3
enum
float_denorm_style
:
denorm_indeterminate
=
-
1
denorm_absent
=
0
denorm_present
=
1
#The static methods can be called as, e.g. numeric_limits[int].round_error(), etc.
#The const data members should be declared as static. Cython currently doesn't allow that
#and/or I can't figure it out, so you must instantiate an object to access, e.g.
#cdef numeric_limits[double] lm
#print lm.round_style
cdef
cppclass
numeric_limits
[
T
]:
const
bint
is_specialized
@
staticmethod
T
min
()
@
staticmethod
T
max
()
const
int
digits
const
int
digits10
const
bint
is_signed
const
bint
is_integer
const
bint
is_exact
const
int
radix
@
staticmethod
T
epsilon
()
@
staticmethod
T
round_error
()
const
int
min_exponent
const
int
min_exponent10
const
int
max_exponent
const
int
max_exponent10
const
bint
has_infinity
const
bint
has_quiet_NaN
const
bint
has_signaling_NaN
const
float_denorm_style
has_denorm
const
bint
has_denorm_loss
@
staticmethod
T
infinity
()
@
staticmethod
T
quiet_NaN
()
@
staticmethod
T
signaling_NaN
()
@
staticmethod
T
denorm_min
()
const
bint
is_iec559
const
bint
is_bounded
const
bint
is_modulo
const
bint
traps
const
bint
tinyness_before
const
float_round_style
round_style
tests/run/libcpp_all.pyx
View file @
0c62e665
...
...
@@ -13,6 +13,7 @@ cimport libcpp.set
cimport
libcpp.stack
cimport
libcpp.vector
cimport
libcpp.complex
cimport
libcpp.limits
from
libcpp.deque
cimport
*
from
libcpp.list
cimport
*
...
...
@@ -23,6 +24,7 @@ from libcpp.set cimport *
from
libcpp.stack
cimport
*
from
libcpp.vector
cimport
*
from
libcpp.complex
cimport
*
from
libcpp.limits
cimport
*
cdef
libcpp
.
deque
.
deque
[
int
]
d1
=
deque
[
int
]()
cdef
libcpp
.
list
.
list
[
int
]
l1
=
list
[
int
]()
...
...
@@ -91,3 +93,17 @@ cdef const_vector_to_list(const vector[double]& cv):
lst
.
append
(
cython
.
operator
.
dereference
(
iter
))
cython
.
operator
.
preincrement
(
iter
)
return
lst
cdef
double
dmax
=
numeric_limits
[
double
].
max
()
cdef
double
dmin
=
numeric_limits
[
double
].
min
()
cdef
double
deps
=
numeric_limits
[
double
].
epsilon
()
cdef
double
dqnan
=
numeric_limits
[
double
].
quiet_NaN
()
cdef
double
dsnan
=
numeric_limits
[
double
].
signaling_NaN
()
cdef
double
dinf
=
numeric_limits
[
double
].
infinity
()
cdef
int
imax
=
numeric_limits
[
int
].
max
()
cdef
int
imin
=
numeric_limits
[
int
].
min
()
cdef
int
ieps
=
numeric_limits
[
int
].
epsilon
()
cdef
int
iqnan
=
numeric_limits
[
int
].
quiet_NaN
()
cdef
int
isnan
=
numeric_limits
[
int
].
signaling_NaN
()
cdef
int
iinf
=
numeric_limits
[
int
].
infinity
()
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