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
dffc0a4c
Commit
dffc0a4c
authored
Jan 23, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cast double to float when coercing from object to float
parent
b3d32712
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+7
-3
No files found.
Cython/Compiler/PyrexTypes.py
View file @
dffc0a4c
...
...
@@ -1661,6 +1661,8 @@ class CFloatType(CNumericType):
def
__init__
(
self
,
rank
,
math_h_modifier
=
''
):
CNumericType
.
__init__
(
self
,
rank
,
1
)
self
.
math_h_modifier
=
math_h_modifier
if
rank
==
RANK_FLOAT
:
self
.
from_py_function
=
"__pyx_PyFloat_AsFloat"
def
assignable_from_resolved_type
(
self
,
src_type
):
return
(
src_type
.
is_numeric
and
not
src_type
.
is_complex
)
or
src_type
is
error_type
...
...
@@ -3130,8 +3132,10 @@ rank_to_type_name = (
"long double"
,
# 7
)
RANK_INT
=
list
(
rank_to_type_name
).
index
(
'int'
)
RANK_LONG
=
list
(
rank_to_type_name
).
index
(
'long'
)
_rank_to_type_name
=
list
(
rank_to_type_name
)
RANK_INT
=
_rank_to_type_name
.
index
(
'int'
)
RANK_LONG
=
_rank_to_type_name
.
index
(
'long'
)
RANK_FLOAT
=
_rank_to_type_name
.
index
(
'float'
)
UNSIGNED
=
0
SIGNED
=
2
...
...
@@ -3644,7 +3648,7 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
"""
+
type_conversion_predeclarations
# Note: __Pyx_PyObject_IsTrue is written to minimize branching.
...
...
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