projects
/
cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
56f8819
)
reduce the chance of rounding errors on int->float coercion
author
Stefan Behnel
<scoder@users.berlios.de>
Tue, 29 Mar 2011 06:55:10 +0000
(08:55 +0200)
committer
Stefan Behnel
<scoder@users.berlios.de>
Tue, 29 Mar 2011 06:55:10 +0000
(08:55 +0200)
Cython/Compiler/ExprNodes.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/ExprNodes.py
b/Cython/Compiler/ExprNodes.py
index d90b4b17fe4bf65cba3fe99203fb6a895f9f2875..2f51d4fb092116d83c8a900bcb311debd484f48c 100755
(executable)
--- a/
Cython/Compiler/ExprNodes.py
+++ b/
Cython/Compiler/ExprNodes.py
@@
-861,9
+861,8
@@
class IntNode(ConstNode):
return self
elif dst_type.is_float:
if self.constant_result is not not_a_constant:
- float_value = float(self.constant_result)
- return FloatNode(self.pos, value=repr(float_value), type=dst_type,
- constant_result=float_value)
+ return FloatNode(self.pos, value='%d.0' % int(self.constant_result), type=dst_type,
+ constant_result=float(self.constant_result))
else:
return FloatNode(self.pos, value=self.value, type=dst_type,
constant_result=not_a_constant)