Example #1
0
def resolve_pow(type, args):
    have_mod = len(args) == 3

    if (type.is_int or type.is_float) and not have_mod and not is_win32:
        result = resolve_intrinsic(args, pow, type)
    else:
        result = nodes.call_pyfunc(pow, args)

    return nodes.CoercionNode(result, type)
Example #2
0
def resolve_pow(type, args):
    have_mod = len(args) == 3

    if (type.is_int or type.is_float) and not have_mod and not is_win32:
        result = resolve_intrinsic(args, pow, type)
    else:
        result = nodes.call_pyfunc(pow, args)

    return nodes.CoercionNode(result, type)
Example #3
0
    def visit_MathNode(self, math_node):
        "Translate a nodes.MathNode to an intrinsic or libc math call"
        from numba.type_inference.modules import mathmodule
        lowerable = is_math_function([math_node.arg], math_node.py_func)

        if math_node.type.is_array or not lowerable:
            # Generate a Python call
            assert math_node.py_func is not None
            result = nodes.call_pyfunc(math_node.py_func, [math_node.arg])
            result = result.coerce(math_node.type)
        else:
            # Lower to intrinsic or libc math call
            args = [math_node.arg], math_node.py_func, math_node.type
            if is_intrinsic(math_node.py_func):
                result = resolve_intrinsic(*args)
            else:
                result = resolve_libc_math(*args)

        return self.visit(result)
Example #4
0
    def visit_MathNode(self, math_node):
        "Translate a nodes.MathNode to an intrinsic or libc math call"
        from numba.type_inference.modules import mathmodule
        lowerable = is_math_function([math_node.arg], math_node.py_func)

        if math_node.type.is_array or not lowerable:
            # Generate a Python call
            assert math_node.py_func is not None
            result = nodes.call_pyfunc(math_node.py_func, [math_node.arg])
            result = result.coerce(math_node.type)
        else:
            # Lower to intrinsic or libc math call
            args = [math_node.arg], math_node.py_func, math_node.type
            if is_intrinsic(math_node.py_func):
                result = resolve_intrinsic(*args)
            else:
                result = resolve_libc_math(*args)

        return self.visit(result)