Commit 09d92f6f authored by Stefan Behnel's avatar Stefan Behnel

reduce the chance of rounding errors on int->float coercion

parent 56f8819b
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment