More large literal as double fixes.
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 27 May 2010 04:04:08 +0000 (21:04 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 27 May 2010 04:04:08 +0000 (21:04 -0700)
Cython/Compiler/ExprNodes.py
Cython/Compiler/Nodes.py
tests/run/literals.pyx

index 94172f2b3e50f3e1ed92da2f2ea8271cbdb70231..413a51f2e949fc8bc267e225f55337522d41ca73 100755 (executable)
@@ -4993,8 +4993,9 @@ class NumBinopNode(BinopNode):
             return
         if self.type.is_complex:
             self.infix = False
-        self.operand1 = self.operand1.coerce_to(self.type, env)
-        self.operand2 = self.operand2.coerce_to(self.type, env)
+        if not self.infix or (type1.is_numeric and type2.is_numeric):
+            self.operand1 = self.operand1.coerce_to(self.type, env)
+            self.operand2 = self.operand2.coerce_to(self.type, env)
     
     def compute_c_result_type(self, type1, type2):
         if self.c_types_okay(type1, type2):
index f1ee64a5da8ab2e345b9b4982dc661c954d5bf1e..9b4fa4c2b6e3b58fbd5da5059ef12f8060ab6cd2 100644 (file)
@@ -3345,7 +3345,7 @@ class InPlaceAssignmentNode(AssignmentNode):
         import ExprNodes
         if self.lhs.type.is_pyobject:
             self.rhs = self.rhs.coerce_to_pyobject(env)
-        elif self.rhs.type.is_pyobject:
+        elif self.rhs.type.is_pyobject or (self.lhs.type.is_numeric and self.rhs.type.is_numeric):
             self.rhs = self.rhs.coerce_to(self.lhs.type, env)
         if self.lhs.type.is_pyobject:
             self.result_value_temp = ExprNodes.PyTempNode(self.pos, env)
index 181dea639668fde1afbdd1d6e20e95cb762b0978..388fe675481f31513300c9cbb0c845c4b196405a 100644 (file)
@@ -66,6 +66,8 @@ def test_complex(x):
 def test_large_int(double x):
     """
     >>> test_large_int(0)
-    1e+100
+    2e+100
     """
-    return x + 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+    a = x + 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+    a += 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+    return a