this_append_before for Fraction
This commit is contained in:
parent
1ecdb458ae
commit
619e809c6b
@ -68,7 +68,7 @@ class Fraction(Explicable):
|
||||
elif self._denom < 0:
|
||||
n_frac = Fraction(-self._num, -self._denom)
|
||||
ans = n_frac.simplify()
|
||||
ans.steps = ini_step + ans.steps
|
||||
ans.this_append_before(ini_step)
|
||||
return ans
|
||||
|
||||
gcd_ = gcd(abs(self._num), abs(self._denom))
|
||||
@ -82,7 +82,7 @@ class Fraction(Explicable):
|
||||
n_frac._denom, gcd_, op.mul,
|
||||
op.div])]
|
||||
|
||||
n_frac.steps = ini_step + n_frac.steps
|
||||
n_frac.this_append_before(ini_step)
|
||||
return n_frac
|
||||
|
||||
else:
|
||||
@ -196,7 +196,7 @@ class Fraction(Explicable):
|
||||
ans = exp.simplify()
|
||||
ini_step = Expression(self.postfix_tokens +
|
||||
number.postfix_tokens + [op.add])
|
||||
ans.steps = [ini_step] + ans.steps
|
||||
ans.this_append_before([ini_step])
|
||||
return ans
|
||||
|
||||
def __radd__(self, other):
|
||||
@ -263,7 +263,7 @@ class Fraction(Explicable):
|
||||
ini_step = Expression(self.postfix_tokens +
|
||||
number.postfix_tokens + [op.sub])
|
||||
ans = exp.simplify()
|
||||
ans.steps = [ini_step] + ans.steps
|
||||
ans.this_append_before([ini_step])
|
||||
return ans
|
||||
|
||||
def __rsub__(self, other):
|
||||
@ -423,7 +423,7 @@ class Fraction(Explicable):
|
||||
number = Fraction(number._denom, number._num)
|
||||
ans = self * number
|
||||
|
||||
ans.steps = [ini_step] + ans.steps
|
||||
ans.this_append_before([ini_step])
|
||||
return ans
|
||||
|
||||
def __rtruediv__(self, other):
|
||||
@ -475,7 +475,7 @@ class Fraction(Explicable):
|
||||
[self._num, power, op.pw, self._denom, power, op.pw, op.div])
|
||||
|
||||
ans = exp.simplify()
|
||||
ans.steps = [ini_step] + ans.steps
|
||||
ans.this_append_before([ini_step])
|
||||
return ans
|
||||
|
||||
def __xor__(self, power):
|
||||
|
Loading…
Reference in New Issue
Block a user