[pypy-svn] r15280 - pypy/dist/pypy/module/math

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Jul 28 19:31:41 CEST 2005


Author: cfbolz
Date: Thu Jul 28 19:31:38 2005
New Revision: 15280

Modified:
   pypy/dist/pypy/module/math/__init__.py
   pypy/dist/pypy/module/math/interp_math.py
Log:
enabled all math functions since there are now external function definitions for everything.

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 19:31:38 2005
@@ -10,35 +10,33 @@
     #     is that we need to add support to
     #     extfunctable/translation
     interpleveldefs = {
-           'e'              : 'interp_math.get(space).w_e', 
-           'pi'             : 'interp_math.get(space).w_pi', 
-           #'pow'            : 'interp_math.pow',
-           'cosh'           : 'interp_math.cosh',
-           'ldexp'          : 'interp_math.ldexp',
-           'hypot'          : 'interp_math.hypot',
-           #'tan'            : 'interp_math.tan',
-           #'asin'           : 'interp_math.asin',
-           'fabs'           : 'interp_math.fabs',
-           'floor'          : 'interp_math.floor',
-           #'sqrt'           : 'interp_math.sqrt',
-           'frexp'          : 'interp_math.frexp',
-           #'degrees'        : 'interp_math.degrees',
-           'log'             : 'interp_math.log',
-           'log10'          : 'interp_math.log10',
-           'fmod'           : 'interp_math.fmod',
-           #'atan'           : 'interp_math.atan',
-           'ceil'           : 'interp_math.ceil',
-           'sinh'           : 'interp_math.sinh',
-           'acos'           : 'interp_math.acos',
-           'sin'            : 'interp_math.sin',
-           'sqrt'           : 'interp_math.sqrt',
-           'cos'            : 'interp_math.cos',
-           #'tanh'           : 'interp_math.tanh',
-           #'radians'        : 'interp_math.radians',
-           #'sin'            : 'interp_math.sin',
-           'atan2'          : 'interp_math.atan2',
-           'modf'           : 'interp_math.modf',
-           'exp'            : 'interp_math.exp',
-           'acos'           : 'interp_math.acos',
-
+       'e'              : 'interp_math.get(space).w_e', 
+       'pi'             : 'interp_math.get(space).w_pi', 
+       'pow'            : 'interp_math.pow',
+       'cosh'           : 'interp_math.cosh',
+       'ldexp'          : 'interp_math.ldexp',
+       'hypot'          : 'interp_math.hypot',
+       'tan'            : 'interp_math.tan',
+       'asin'           : 'interp_math.asin',
+       'log'            : 'interp_math.log',
+       'fabs'           : 'interp_math.fabs',
+       'floor'          : 'interp_math.floor',
+       'sqrt'           : 'interp_math.sqrt',
+       'frexp'          : 'interp_math.frexp',
+       'degrees'        : 'interp_math.degrees',
+       'log'            : 'interp_math.log',
+       'log10'          : 'interp_math.log10',
+       'fmod'           : 'interp_math.fmod',
+       'atan'           : 'interp_math.atan',
+       'ceil'           : 'interp_math.ceil',
+       'sinh'           : 'interp_math.sinh',
+       'cos'            : 'interp_math.cos',
+       'tanh'           : 'interp_math.tanh',
+       'radians'        : 'interp_math.radians',
+       'sin'            : 'interp_math.sin',
+       'atan2'          : 'interp_math.atan2',
+       'modf'           : 'interp_math.modf',
+       'exp'            : 'interp_math.exp',
+       'acos'           : 'interp_math.acos',
 }
+

Modified: pypy/dist/pypy/module/math/interp_math.py
==============================================================================
--- pypy/dist/pypy/module/math/interp_math.py	(original)
+++ pypy/dist/pypy/module/math/interp_math.py	Thu Jul 28 19:31:38 2005
@@ -14,7 +14,7 @@
        
        Return x**y (x to the power of y).
     """
-    return space.wrap(math.pow(x, y))
+    return space.wrap(x ** y)
 pow.unwrap_spec = [ObjSpace, float, float]
 
 def cosh(space, x): 
@@ -101,10 +101,12 @@
     return space.newtuple([space.wrap(mant), space.wrap(expo)])
 frexp.unwrap_spec = [ObjSpace, float]
 
+degToRad = math.pi / 180.0
+
 def degrees(space, x): 
     """degrees(x) -> converts angle x from radians to degrees
     """
-    return space.wrap(math.degrees(x))
+    return space.wrap(x * degToRad)
 degrees.unwrap_spec = [ObjSpace, float]
 
 def log10(space, x): 
@@ -165,7 +167,7 @@
 def radians(space, x): 
     """radians(x) -> converts angle x from degrees to radians
     """
-    return space.wrap(math.radians(x))
+    return space.wrap(x / degToRad)
 radians.unwrap_spec = [ObjSpace, float]
 
 def sin(space, x): 



More information about the Pypy-commit mailing list