[pypy-svn] pypy cmath: (lac, arigo)

arigo commits-noreply at bitbucket.org
Mon Jan 17 17:45:22 CET 2011

Author: Armin Rigo <arigo at tunes.org>
Branch: cmath
Changeset: r40785:e143bb6a97f1
Date: 2011-01-17 17:45 +0100

Log:	(lac, arigo)


diff --git a/pypy/module/cmath/__init__.py b/pypy/module/cmath/__init__.py
--- a/pypy/module/cmath/__init__.py
+++ b/pypy/module/cmath/__init__.py
@@ -13,6 +13,7 @@
     'log': ("log(x[, base]) -> the logarithm of x to the given base.\n"
             "If the base not specified, returns the natural logarithm "
             "(base e) of x."),
+    'log10': "Return the base-10 logarithm of x.",

diff --git a/pypy/module/cmath/interp_cmath.py b/pypy/module/cmath/interp_cmath.py
--- a/pypy/module/cmath/interp_cmath.py
+++ b/pypy/module/cmath/interp_cmath.py
@@ -4,7 +4,8 @@
 from pypy.interpreter.gateway import ObjSpace, W_Root, NoneNotWrapped
 from pypy.module.cmath import Module, names_and_docstrings
 from pypy.module.cmath.constant import DBL_MIN, CM_SCALE_UP, CM_SCALE_DOWN
-from pypy.module.cmath.constant import CM_LARGE_DOUBLE, M_LN2, DBL_MANT_DIG
+from pypy.module.cmath.constant import CM_LARGE_DOUBLE, DBL_MANT_DIG
+from pypy.module.cmath.constant import M_LN2, M_LN10
 from pypy.module.cmath.constant import CM_SQRT_LARGE_DOUBLE, CM_SQRT_DBL_MIN
 from pypy.module.cmath.special_value import isfinite, special_type
 from pypy.module.cmath.special_value import sqrt_special_values
@@ -277,3 +278,9 @@
         return space.truediv(w_logz, w_logbase)
         return w_logz
+ at unaryfn
+def c_log10(x, y):
+    rx, ry = c_log(x, y)
+    return (rx / M_LN10, ry / M_LN10)

More information about the Pypy-commit mailing list