Python_2  1.0
Classes | Functions
_01a_fracao Namespace Reference

A very simple fraction class. More...

Classes

class  Fracao
 A simple class for creating fraction objects (rational numbers). More...
 

Functions

def mdc (x, y)
 mdc is a general use function, defined outside the class. More...
 
def main ()
 Main program for testing. More...
 

Detailed Description

A very simple fraction class.

Author
Miguel Jonathan e Paulo Roma
Since
16/09/2009
See also
http://docs.python.org/library/fractions.html
http://docs.python.org/reference/datamodel.html#emulating-numeric-types
https://docs.python.org/2/library/operator.html

In the future, Python will switch to always yielding a real result, and to force an integer division operation, you use the special "//" integer division operator. If you want that behavior now, just import that "from the future":

Function Documentation

◆ main()

def _01a_fracao.main ( )

Main program for testing.

◆ mdc()

def _01a_fracao.mdc (   x,
  y 
)

mdc is a general use function, defined outside the class.

Parameters
xfirst integer: numerator.
ysecond integer: denominator.
Returns
GCD: Greatest Common Divisor.
Greatest Common Divisor (Maximo divisor comum).

Referenced by _01a_fracao.Fracao.simplifica().