Commits

Alex Gaynor  committed b705108

math.copysign is a pure function, as is floor() which doesn't have any error conditions.

  • Participants
  • Parent commits f353797

Comments (0)

Files changed (1)

File pypy/rpython/lltypesystem/module/ll_math.py

     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,
 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)
 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)
 
 # ____________________________________________________________
 #
     return (y == INFINITY) | (y == -INFINITY)
 
 
+ll_math_floor = math_floor
+
 ll_math_copysign = math_copysign
 
 
 
 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',
     ]