Commit 5da90229 authored by Robert Bradshaw's avatar Robert Bradshaw

Must use repr() not str() for literal floats.

parent b6bdc98a
...@@ -885,7 +885,7 @@ class FloatNode(ConstNode): ...@@ -885,7 +885,7 @@ class FloatNode(ConstNode):
return float(self.value) return float(self.value)
def calculate_result_code(self): def calculate_result_code(self):
strval = str(self.value) strval = repr(float(self.value))
if strval == 'nan': if strval == 'nan':
return "(Py_HUGE_VAL * 0)" return "(Py_HUGE_VAL * 0)"
elif strval == 'inf': elif strval == 'inf':
...@@ -1042,9 +1042,9 @@ class ImagNode(AtomicNewTempExprNode): ...@@ -1042,9 +1042,9 @@ class ImagNode(AtomicNewTempExprNode):
def generate_result_code(self, code): def generate_result_code(self, code):
code.putln( code.putln(
"%s = PyComplex_FromDoubles(0.0, %s); %s" % ( "%s = PyComplex_FromDoubles(0.0, %r); %s" % (
self.result(), self.result(),
self.value, float(self.value),
code.error_goto_if_null(self.result(), self.pos))) code.error_goto_if_null(self.result(), self.pos)))
code.put_gotref(self.py_result()) code.put_gotref(self.py_result())
......
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