![]() |
Python_2
1.0
|
A simple class for creating fraction objects (rational numbers). More...
Public Member Functions | |
def | __init__ (self, num=1, den=1) |
Constructor. More... | |
def | __eq__ (self, f) |
Operator ==. More... | |
def | __add__ (self, f) |
Operator +. More... | |
def | __radd__ (self, f) |
Operador right side addition. More... | |
def | __iadd__ (self, f) |
Operator +=. More... | |
def | __mul__ (self, f) |
Operator *. More... | |
def | __rmul__ (self, f) |
Operador right side multiplication. More... | |
def | __div__ (self, f) |
Operator /. More... | |
def | __truediv__ (self, f) |
Operator /. More... | |
def | __floordiv__ (self, f) |
Operator //. More... | |
def | __rdiv__ (self, f) |
Operador right side integer division (python 2). More... | |
def | __rtruediv__ (self, f) |
Operador right side float division (python 3). More... | |
def | __rfloordiv__ (self, f) |
Operador right side integer division. More... | |
def | __sub__ (self, f) |
Operator -. More... | |
def | __rsub__ (self, f) |
Operador right side subtraction. More... | |
def | __neg__ (self) |
Operator -. More... | |
def | __str__ (self) |
Controls how a fraction is printed. More... | |
def | simplifica (self) |
Simplifies this fraction, by dividing either the numerator or the denominator by its gcd. More... | |
Public Attributes | |
num | |
Numerator. More... | |
den | |
Denominator. More... | |
A simple class for creating fraction objects (rational numbers).
def _01a_fracao.Fracao.__init__ | ( | self, | |
num = 1 , |
|||
den = 1 |
|||
) |
Constructor.
num | numerator. |
den | denominator |
Constructor
def _01a_fracao.Fracao.__add__ | ( | self, | |
f | |||
) |
Operator +.
References _01a_fracao.Fracao.den, and _01a_fracao.Fracao.num.
Referenced by _01c_vector.vector.__sub__(), and _01f_vector.vector.__sub__().
def _01a_fracao.Fracao.__div__ | ( | self, | |
f | |||
) |
Operator /.
def _01a_fracao.Fracao.__eq__ | ( | self, | |
f | |||
) |
Operator ==.
References _01a_fracao.Fracao.simplifica().
def _01a_fracao.Fracao.__floordiv__ | ( | self, | |
f | |||
) |
def _01a_fracao.Fracao.__iadd__ | ( | self, | |
f | |||
) |
Operator +=.
References _01a_fracao.Fracao.den, _01a_fracao.Fracao.num, and _01a_fracao.Fracao.simplifica().
def _01a_fracao.Fracao.__mul__ | ( | self, | |
f | |||
) |
Operator *.
References _01a_fracao.Fracao.den, and _01a_fracao.Fracao.num.
Referenced by _01c_vector.vector.__truediv__(), and _01f_vector.vector.__truediv__().
def _01a_fracao.Fracao.__neg__ | ( | self | ) |
Operator -.
References _01a_fracao.Fracao.den, and _01a_fracao.Fracao.num.
def _01a_fracao.Fracao.__radd__ | ( | self, | |
f | |||
) |
Operador right side addition.
This method is only called if the left object does not have an add method, or that method does not know how to add the two objects (which it flags by returning NotImplemented).
def _01a_fracao.Fracao.__rdiv__ | ( | self, | |
f | |||
) |
Operador right side integer division (python 2).
This method is only called if the left object does not have a div method, or that method does not know how to add the two objects (which it flags by returning NotImplemented).
References _01a_fracao.Fracao.__rfloordiv__().
def _01a_fracao.Fracao.__rfloordiv__ | ( | self, | |
f | |||
) |
Operador right side integer division.
This method is only called if the left object does not have a floordiv method, or that method does not know how to add the two objects (which it flags by returning NotImplemented).
References _01a_fracao.Fracao.den, and _01a_fracao.Fracao.num.
Referenced by _01a_fracao.Fracao.__rdiv__(), and _01a_fracao.Fracao.__rtruediv__().
def _01a_fracao.Fracao.__rmul__ | ( | self, | |
f | |||
) |
Operador right side multiplication.
This method is only called if the left object does not have a mul method, or that method does not know how to add the two objects (which it flags by returning NotImplemented).
def _01a_fracao.Fracao.__rsub__ | ( | self, | |
f | |||
) |
Operador right side subtraction.
This method is only called if the left object does not have a sub method, or that method does not know how to add the two objects (which it flags by returning NotImplemented).
def _01a_fracao.Fracao.__rtruediv__ | ( | self, | |
f | |||
) |
Operador right side float division (python 3).
This method is only called if the left object does not have a truediv method, or that method does not know how to add the two objects (which it flags by returning NotImplemented).
References _01a_fracao.Fracao.__rfloordiv__().
def _01a_fracao.Fracao.__str__ | ( | self | ) |
Controls how a fraction is printed.
References _01a_fracao.Fracao.den, and _01a_fracao.Fracao.num.
def _01a_fracao.Fracao.__sub__ | ( | self, | |
f | |||
) |
Operator -.
def _01a_fracao.Fracao.__truediv__ | ( | self, | |
f | |||
) |
Operator /.
def _01a_fracao.Fracao.simplifica | ( | self | ) |
Simplifies this fraction, by dividing either the numerator or the denominator by its gcd.
References _01a_fracao.Fracao.den, _01a_fracao.mdc(), and _01a_fracao.Fracao.num.
Referenced by _01a_fracao.Fracao.__eq__(), and _01a_fracao.Fracao.__iadd__().
_01a_fracao.Fracao.den |
_01a_fracao.Fracao.num |