[pypy-svn] pypy default: math.copysign is a pure function, as is floor() which doesn't have any error conditions.
alex_gaynor
commits-noreply at bitbucket.org
Thu Apr 21 00:25:15 CEST 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r43501:b7051089b674
Date: 2011-04-20 18:24 -0400
http://bitbucket.org/pypy/pypy/changeset/b7051089b674/
Log: math.copysign is a pure function, as is floor() which doesn't have
any error conditions.
diff --git a/pypy/rpython/lltypesystem/module/ll_math.py b/pypy/rpython/lltypesystem/module/ll_math.py
--- a/pypy/rpython/lltypesystem/module/ll_math.py
+++ b/pypy/rpython/lltypesystem/module/ll_math.py
@@ -29,9 +29,9 @@
math_eci = eci
math_prefix = ''
-def llexternal(name, ARGS, RESULT):
+def llexternal(name, ARGS, RESULT, **kwargs):
return rffi.llexternal(name, ARGS, RESULT, compilation_info=eci,
- sandboxsafe=True)
+ sandboxsafe=True, **kwargs)
def math_llexternal(name, ARGS, RESULT):
return rffi.llexternal(math_prefix + name, ARGS, RESULT,
@@ -47,7 +47,8 @@
math_log = llexternal('log', [rffi.DOUBLE], rffi.DOUBLE)
math_log10 = llexternal('log10', [rffi.DOUBLE], rffi.DOUBLE)
math_copysign = llexternal(underscore + 'copysign',
- [rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
+ [rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE,
+ pure_function=True)
math_atan2 = llexternal('atan2', [rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
math_frexp = llexternal('frexp', [rffi.DOUBLE, rffi.INTP], rffi.DOUBLE)
math_modf = llexternal('modf', [rffi.DOUBLE, rffi.DOUBLEP], rffi.DOUBLE)
@@ -56,7 +57,7 @@
math_fmod = llexternal('fmod', [rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
math_hypot = llexternal(underscore + 'hypot',
[rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
-math_isinf = math_llexternal('isinf', [rffi.DOUBLE], rffi.INT)
+math_floor = llexternal('floor', [rffi.DOUBLE], rffi.DOUBLE, pure_function=True)
# ____________________________________________________________
#
@@ -99,6 +100,8 @@
return (y == INFINITY) | (y == -INFINITY)
+ll_math_floor = math_floor
+
ll_math_copysign = math_copysign
@@ -337,7 +340,7 @@
unary_math_functions = [
'acos', 'asin', 'atan',
- 'ceil', 'cos', 'cosh', 'exp', 'fabs', 'floor',
+ 'ceil', 'cos', 'cosh', 'exp', 'fabs',
'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'log', 'log10',
'acosh', 'asinh', 'atanh', 'log1p', 'expm1',
]
More information about the Pypy-commit
mailing list