Solve bug with simplification of fractions
This commit is contained in:
parent
412149f22d
commit
eb1088d31f
@ -331,6 +331,7 @@ def test(exp):
|
|||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Expression.STR_RENDER = txt
|
||||||
#exp = "2 ^ 3 * 5"
|
#exp = "2 ^ 3 * 5"
|
||||||
#test(exp)
|
#test(exp)
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ class Fraction(object):
|
|||||||
n_frac = self
|
n_frac = self
|
||||||
|
|
||||||
gcd_ = gcd(abs(n_frac._num), abs(n_frac._denom))
|
gcd_ = gcd(abs(n_frac._num), abs(n_frac._denom))
|
||||||
if n_frac._num == n_frac._denom:
|
if gcd_ == n_frac._denom:
|
||||||
n_frac = Fraction(1,1)
|
n_frac = n_frac._num // gcd_
|
||||||
steps.append(n_frac)
|
steps.append(n_frac)
|
||||||
|
|
||||||
elif gcd_ != 1:
|
elif gcd_ != 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user