[pypy-svn] r18257 - in pypy/dist/pypy/translator/c: . test

pedronis at codespeak.net pedronis at codespeak.net
Fri Oct 7 12:35:15 CEST 2005


Author: pedronis
Date: Fri Oct  7 12:35:14 2005
New Revision: 18257

Modified:
   pypy/dist/pypy/translator/c/primitive.py
   pypy/dist/pypy/translator/c/test/test_genc.py
Log:
spell infinity as HUGE_VAL (Py_HUGE_VAL for now precisely)



Modified: pypy/dist/pypy/translator/c/primitive.py
==============================================================================
--- pypy/dist/pypy/translator/c/primitive.py	(original)
+++ pypy/dist/pypy/translator/c/primitive.py	Fri Oct  7 12:35:14 2005
@@ -20,13 +20,10 @@
 
 def name_float(value):
     if isinf(value):
-        # the following seems to produce an inf both on gcc and MS compilers
-        # XXX but it depends on the size of the doubles
-        assert isinf(1E200*1E200)
         if value > 0:
-            return '(1E200*1E200)'
+            return '(Py_HUGE_VAL)'
         else:
-            return '(-1E200*1E200)'
+            return '(-Py_HUGE_VAL)'
     else:
         return repr(value)
 

Modified: pypy/dist/pypy/translator/c/test/test_genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_genc.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_genc.py	Fri Oct  7 12:35:14 2005
@@ -211,6 +211,11 @@
     f1 = compile(fn, [])
     res = f1()
     assert res > 0 and res == res / 2
+    def fn():
+        return -x
+    f1 = compile(fn, [])
+    res = f1()
+    assert res < 0 and res == res / 2
 
 
 def test_x():



More information about the Pypy-commit mailing list