Home | History | Annotate | Download | only in python2.7

Lines Matching full:rational

4 """Rational, infinite-precision, real numbers."""
15 Rational = numbers.Rational
44 class Fraction(Rational):
45 """This class implements rational numbers.
48 produce a rational number equivalent to 4/3. Both arguments must
49 be Rational. The numerator defaults to 0 and the denominator
61 - other Rational instances (including integers)
71 Takes a string like '3/2' or '1.5', another Rational instance, a
102 if isinstance(numerator, Rational):
149 "or a Rational instance")
151 elif (isinstance(numerator, Rational) and
152 isinstance(denominator, Rational)):
159 "Rational instances")
170 """Converts a finite float to a rational number, exactly.
186 """Converts a finite Decimal instance to a rational number, exactly."""
218 # approximation* to x to be a rational number p/q such that:
221 # (2) if p/q > r/s >= x then s > q, for any rational r/s.
224 # proved that a rational number is a best upper or lower
229 # To find a best rational approximation with denominator <= M,
281 """Generates forward and reverse operators given a purely-rational
312 if isinstance(other, Rational):
327 Rational (r : Fraction <: Rational), and b : B <:
336 __add__. In particular, we don't handle Rational
349 4. If B <: Rational, then __radd_ converts both to the
350 builtin rational type (hey look, that's us) and
373 if isinstance(a, Rational):
421 if isinstance(div, Rational):
422 # trunc(math.floor(div)) doesn't work if the rational is
433 if isinstance(div, Rational):
434 # trunc(math.floor(div)) doesn't work if the rational is
456 result will be rational.
459 if isinstance(b, Rational):
481 if isinstance(a, Rational):
529 if isinstance(b, Rational):
549 Implement comparison between a Rational instance `self`, and
550 either another Rational instance or a float `other`. If
551 `other` is not a Rational instance or a float, return
556 # convert other to a Rational instance where reasonable.
557 if isinstance(other, Rational):