Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start to reduce/refactor arithmetic ... #889

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions mathics/builtin/arithfns/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
"""
Basic Arithmetic

The functions here are the basic arithmetic operations that you might find on a calculator.
The functions here are the basic arithmetic operations that you might find \
on a calculator.

"""

from mathics.builtin.arithmetic import _MPMathFunction, create_infix
from mathics.builtin.base import BinaryOperator, Builtin, PrefixOperator, SympyFunction
from mathics.builtin.arithmetic import create_infix
from mathics.builtin.base import (
BinaryOperator,
Builtin,
MPMathFunction,
PrefixOperator,
SympyFunction,
)
from mathics.core.atoms import (
Complex,
Integer,
Expand Down Expand Up @@ -387,7 +394,7 @@ def eval(self, items, evaluation):
return eval_Plus(*items_tuple)


class Power(BinaryOperator, _MPMathFunction):
class Power(BinaryOperator, MPMathFunction):
"""
<url>
:Exponentiation:
Expand Down Expand Up @@ -531,7 +538,7 @@ class Power(BinaryOperator, _MPMathFunction):
def eval_check(self, x, y, evaluation):
"Power[x_, y_]"

# Power uses _MPMathFunction but does some error checking first
# Power uses MPMathFunction but does some error checking first
if isinstance(x, Number) and x.is_zero:
if isinstance(y, Number):
y_err = y
Expand Down Expand Up @@ -788,7 +795,6 @@ def inverse(item):
and isinstance(item.elements[1], (Integer, Rational, Real))
and item.elements[1].to_sympy() < 0
): # nopep8

negative.append(inverse(item))
elif isinstance(item, Rational):
numerator = item.numerator()
Expand Down
Loading
Loading