Lines Matching refs:Fraction
60 class Fraction(numbers.Rational): class
115 self = super(Fraction, cls).__new__(cls)
262 return Fraction(self)
275 bound1 = Fraction(p0+k*p1, q0+k*q1)
276 bound2 = Fraction(p1, q1)
383 if isinstance(b, (int, Fraction)):
412 return Fraction(a.numerator * db + b.numerator * da,
420 return Fraction(a.numerator * db - b.numerator * da,
427 return Fraction(a.numerator * b.numerator, a.denominator * b.denominator)
433 return Fraction(a.numerator * b.denominator,
448 return div, Fraction(n_mod, da * db)
455 return Fraction((a.numerator * db) % (b.numerator * da), da * db)
471 return Fraction(a._numerator ** power,
475 return Fraction(a._denominator ** -power,
479 return Fraction((-a._denominator) ** -power,
496 return Fraction(a.numerator, a.denominator) ** b
505 return Fraction(a._numerator, a._denominator, _normalize=False)
509 return Fraction(-a._numerator, a._denominator, _normalize=False)
513 return Fraction(abs(a._numerator), a._denominator, _normalize=False)
552 return Fraction(round(self * shift), shift)
554 return Fraction(round(self / shift) * shift)
647 if type(self) == Fraction:
652 if type(self) == Fraction: