cython-devel

changeset 1636:a929b3745f45

Must use repr() not str() for literal floats.
author Robert Bradshaw <robertwb@math.washington.edu>
date Mon Jan 19 17:48:38 2009 -0800 (4 years ago)
parents 7087e1042933
children c99a24b8242a
files Cython/Compiler/ExprNodes.py
line diff
1.1 --- a/Cython/Compiler/ExprNodes.py Mon Jan 19 17:35:51 2009 -0800 1.2 +++ b/Cython/Compiler/ExprNodes.py Mon Jan 19 17:48:38 2009 -0800 1.3 @@ -885,7 +885,7 @@ 1.4 return float(self.value) 1.5 1.6 def calculate_result_code(self): 1.7 - strval = str(self.value) 1.8 + strval = repr(float(self.value)) 1.9 if strval == 'nan': 1.10 return "(Py_HUGE_VAL * 0)" 1.11 elif strval == 'inf': 1.12 @@ -1042,9 +1042,9 @@ 1.13 1.14 def generate_result_code(self, code): 1.15 code.putln( 1.16 - "%s = PyComplex_FromDoubles(0.0, %s); %s" % ( 1.17 - self.result(), 1.18 - self.value, 1.19 + "%s = PyComplex_FromDoubles(0.0, %r); %s" % ( 1.20 + self.result(), 1.21 + float(self.value), 1.22 code.error_goto_if_null(self.result(), self.pos))) 1.23 code.put_gotref(self.py_result()) 1.24