[pypy-svn] r15274 - in pypy/dist/pypy: module/math rpython rpython/module rpython/module/test

ale at codespeak.net ale at codespeak.net
Thu Jul 28 18:47:20 CEST 2005


Author: ale
Date: Thu Jul 28 18:47:19 2005
New Revision: 15274

Modified:
   pypy/dist/pypy/module/math/__init__.py
   pypy/dist/pypy/rpython/extfunctable.py
   pypy/dist/pypy/rpython/module/ll_math.py
   pypy/dist/pypy/rpython/module/test/test_ll_math.py
Log:
added math.fabs (needed for lib-python).

test_cmath passes!

Modified: pypy/dist/pypy/module/math/__init__.py
==============================================================================
--- pypy/dist/pypy/module/math/__init__.py	(original)
+++ pypy/dist/pypy/module/math/__init__.py	Thu Jul 28 18:47:19 2005
@@ -18,8 +18,7 @@
            'hypot'          : 'interp_math.hypot',
            #'tan'            : 'interp_math.tan',
            #'asin'           : 'interp_math.asin',
-           #'log'            : 'interp_math.log',
-           #'fabs'           : 'interp_math.fabs',
+           'fabs'           : 'interp_math.fabs',
            'floor'          : 'interp_math.floor',
            #'sqrt'           : 'interp_math.sqrt',
            'frexp'          : 'interp_math.frexp',

Modified: pypy/dist/pypy/rpython/extfunctable.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunctable.py	(original)
+++ pypy/dist/pypy/rpython/extfunctable.py	Thu Jul 28 18:47:19 2005
@@ -100,3 +100,4 @@
 declare(math.exp    , float         ,  'll_math/exp')
 declare(math.ldexp  , float         ,  'll_math/ldexp')
 declare(math.modf   , modfannotation, 'll_math/modf')
+declare(math.fabs    , float         , 'll_math/fabs')

Modified: pypy/dist/pypy/rpython/module/ll_math.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_math.py	(original)
+++ pypy/dist/pypy/rpython/module/ll_math.py	Thu Jul 28 18:47:19 2005
@@ -88,3 +88,7 @@
     fracpart, intpart = math.modf(x)
     return ll_modf_result(fracpart, intpart)
 ll_math_modf.suggested_primitive = True
+
+def ll_math_fabs(x):
+    return math.fabs(x)
+ll_math_fabs.suggested_primitive = True

Modified: pypy/dist/pypy/rpython/module/test/test_ll_math.py
==============================================================================
--- pypy/dist/pypy/rpython/module/test/test_ll_math.py	(original)
+++ pypy/dist/pypy/rpython/module/test/test_ll_math.py	Thu Jul 28 18:47:19 2005
@@ -30,6 +30,9 @@
 def test_ll_math_sqrt():
     assert ll_math_sqrt(10) == math.sqrt(10)
     
-def test_ll_math_hypot():
-    assert ll_math_hypot(math.pi/3,3) == math.hypot(math.pi/3,3)
+def test_ll_math_fabs():
+    assert ll_math_fabs(math.pi/3,3) == math.fabs(math.pi/3,3)
     
+def test_ll_math_fabs():
+    assert ll_math_fabs(math.pi/3) == math.fabs(math.pi/3)
+    assert ll_math_fabs(-math.pi/3) == math.fabs(-math.pi/3)



More information about the Pypy-commit mailing list