24ab1bff71d480227cb7a7de1d7ef34d0c0fcad2,mathics/builtin/arithmetic.py,_MPMathFunction,apply,#_MPMathFunction#Any#Any#,43

Before Change


            result = from_sympy(result)
            // evaluate leaves to convert e.g. Plus[2, I] -> Complex[2, 1]
            result = result.evaluate_leaves(evaluation)
        elif mpmath_function is not None:
            prec = min_prec(*args)
            with mpmath.workprec(prec):
                sympy_args = [x.to_sympy() for x in args]
                if None in sympy_args:
                    return
                mpmath_args = [sympy2mpmath(x, prec) for x in sympy_args]
                if None in mpmath_args:
                    return
                try:
                    result = self.get_mpmath_function(mpmath_args)(*mpmath_args)
                    result = from_sympy(mpmath2sympy(result, prec))
                except ValueError as exc:
                    text = str(exc)
                    if text == "gamma function pole":
                        return Symbol("ComplexInfinity")
                    else:
                        raise
                except ZeroDivisionError:
                    return
                except SpecialValueError as exc:
                    return Symbol(exc.name)

        return result

After Change


        elif mpmath_function is None:
            return

        if any(arg.is_machine_precision() for arg in args):
            // if any argument has machine precision then the entire calculation
            // is done with machine precision.
            float_args = [arg.get_float_value(n_evaluation=evaluation, permit_complex=True) for arg in args]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: mathics/Mathics
Commit Name: 24ab1bff71d480227cb7a7de1d7ef34d0c0fcad2
Time: 2016-08-05
Author: 16sn6uv@gmail.com
File Name: mathics/builtin/arithmetic.py
Class Name: _MPMathFunction
Method Name: apply


Project Name: brian-team/brian2
Commit Name: 8d60cb0e1b7d501cf774039f55b450e26cceb26b
Time: 2013-05-03
Author: marcel.stimberg@ens.fr
File Name: brian2/stateupdaters/exact.py
Class Name: LinearStateUpdater
Method Name: __call__


Project Name: mathics/Mathics
Commit Name: e56f91c9b60f561712d28faae3e4d047adc67760
Time: 2016-09-14
Author: Bernhard.Liebl@gmx.org
File Name: mathics/builtin/importexport.py
Class Name: Import
Method Name: apply