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

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Jul 28 15:36:15 CEST 2005


Author: cfbolz
Date: Thu Jul 28 15:36:12 2005
New Revision: 15242

Modified:
   pypy/dist/pypy/translator/c/extfunc.py
   pypy/dist/pypy/translator/c/src/ll_math.h
   pypy/dist/pypy/translator/c/test/test_extfunc.py
Log:
added external function call to the c backend

Modified: pypy/dist/pypy/translator/c/extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/c/extfunc.py	(original)
+++ pypy/dist/pypy/translator/c/extfunc.py	Thu Jul 28 15:36:12 2005
@@ -17,7 +17,6 @@
     ll_os  .ll_os_stat:    'LL_os_stat',
     ll_os  .ll_os_fstat:   'LL_os_fstat',
     ll_time.ll_time_clock: 'LL_time_clock',
-    ll_math.ll_math_log10: 'LL_math_log10',
     ll_math.ll_math_ceil:  'LL_math_ceil',
     ll_math.ll_math_frexp: 'LL_math_frexp',
     ll_math.ll_math_atan2: 'LL_math_atan2',
@@ -25,6 +24,8 @@
     ll_math.ll_math_floor: 'LL_math_floor',
     ll_math.ll_math_exp:   'LL_math_exp',
     ll_math.ll_math_ldexp: 'LL_math_ldexp',
+    ll_math.ll_math_log10: 'LL_math_log10',
+    ll_math.ll_math_log:   'LL_math_log',
     ll_math.ll_math_modf:  'LL_math_modf',
     }
 

Modified: pypy/dist/pypy/translator/c/src/ll_math.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_math.h	(original)
+++ pypy/dist/pypy/translator/c/src/ll_math.h	Thu Jul 28 15:36:12 2005
@@ -11,9 +11,7 @@
 
 
 /* XXX completely ignoring exceptions/error checking for now */
-double LL_math_log10(double x) {
-  return log10(x);
-}
+
 double LL_math_ceil(double x) {
   return ceil(x);
 }
@@ -27,6 +25,7 @@
 double LL_math_atan2(double x, double y) {
   return atan2(x, y);
 }
+
 double LL_math_fmod(double x, double y) {
   return fmod(x, y);
 }
@@ -40,6 +39,15 @@
   return ldexp(x, (int) y);
 }
 
+double LL_math_log(double x) {
+  return log(x);
+}
+
+double LL_math_log10(double x) {
+  return log10(x);
+}
+
+
 RPyMODF_RESULT* LL_math_modf(double x) {
   double intpart;
   double fracpart = modf(x, &intpart);

Modified: pypy/dist/pypy/translator/c/test/test_extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_extfunc.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_extfunc.py	Thu Jul 28 15:36:12 2005
@@ -108,6 +108,13 @@
     f = compile(fn, [float])
     assert f(10.123) == modf(10.123)
 
+def test_math_log():
+    from math import log10, log
+    def fn(x):
+        return log10(x) + log(x)
+    f = compile(fn, [float])
+    assert f(32675312.32123) == fn(32675312.32123)
+
 def test_os_path_exists():
     tmpfile = str(udir.join('test_os_path_exists.TMP'))
     def fn():



More information about the Pypy-commit mailing list