# numbers.Rational - pydoc - phpman

Help on class Rational in numbers:

numbers.Rational = class Rational(Real)
 |  .numerator and .denominator should be in lowest terms.
 |
 |  Method resolution order:
 |      Rational
 |      Real
 |      Complex
 |      Number
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __float__(self)
 |      float(self) = self.numerator / self.denominator
 |
 |      It's important that this conversion use the integer's "true"
 |      division rather than casting one side to float before dividing
 |      so that ratios of huge integers convert without overflowing.
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  denominator
 |
 |  numerator
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __abstractmethods__ = frozenset({'__abs__', '__add__', '__ceil__', '__...
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from Real:
 |
 |  __ceil__(self)
 |      Finds the least Integral >= self.
 |
 |  __complex__(self)
 |      complex(self) == complex(float(self), 0)
 |
 |  __divmod__(self, other)
 |      divmod(self, other): The pair (self // other, self % other).
 |
 |      Sometimes this can be computed faster than the pair of
 |      operations.
 |
 |  __floor__(self)
 |      Finds the greatest Integral <= self.
 |
 |  __floordiv__(self, other)
 |      self // other: The floor() of self/other.
 |
 |  __le__(self, other)
 |      self <= other
 |
 |  __lt__(self, other)
 |      self < other
 |
 |      < on Reals defines a total ordering, except perhaps for NaN.
 |
 |  __mod__(self, other)
 |      self % other
 |
 |  __rdivmod__(self, other)
 |      divmod(other, self): The pair (self // other, self % other).
 |
 |      Sometimes this can be computed faster than the pair of
 |      operations.
 |
 |  __rfloordiv__(self, other)
 |      other // self: The floor() of other/self.
 |
 |  __rmod__(self, other)
 |      other % self
 |
 |  __round__(self, ndigits=None)
 |      Rounds self to ndigits decimal places, defaulting to 0.
 |
 |      If ndigits is omitted or None, returns an Integral, otherwise
 |      returns a Real. Rounds half toward even.
 |
 |  __trunc__(self)
 |      trunc(self): Truncates self to an Integral.
 |
 |      Returns an Integral i such that:
 |        * i>0 iff self>0;
 |        * abs(i) <= abs(self);
 |        * for any Integral j satisfying the first two conditions,
 |          abs(i) >= abs(j) [i.e. i has "maximal" abs among those].
 |      i.e. "truncate towards 0".
 |
 |  conjugate(self)
 |      Conjugate is a no-op for Reals.
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties inherited from Real:
 |
 |  imag
 |      Real numbers have no imaginary component.
 |
 |  real
 |      Real numbers are their real component.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from Complex:
 |
 |  __abs__(self)
 |      Returns the Real distance from 0. Called for abs(self).
 |
 |  __add__(self, other)
 |      self + other
 |
 |  __bool__(self)
 |      True if self != 0. Called for bool(self).
 |
 |  __eq__(self, other)
 |      self == other
 |
 |  __mul__(self, other)
 |      self * other
 |
 |  __neg__(self)
 |      -self
 |
 |  __pos__(self)
 |      +self
 |
 |  __pow__(self, exponent)
 |      self**exponent; should promote to float or complex when necessary.
 |
 |  __radd__(self, other)
 |      other + self
 |
 |  __rmul__(self, other)
 |      other * self
 |
 |  __rpow__(self, base)
 |      base ** self
 |
 |  __rsub__(self, other)
 |      other - self
 |
 |  __rtruediv__(self, other)
 |      other / self
 |
 |  __sub__(self, other)
 |      self - other
 |
 |  __truediv__(self, other)
 |      self / other: Should promote to float when necessary.
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from Complex:
 |
 |  __hash__ = None

