Package flumotion :: Package common :: Module fraction
[hide private]

Module fraction

source code

convert to and from fractions


Version: $Rev$

Functions [hide private]
 
gcd(a, b)
Returns the greatest common divisor of two integers.
source code
a two sized tuple with 2 integers
fractionFromValue(value)
Converts a value to a fraction
source code
float
fractionAsFloat(value)
Converts a fraction to a float
source code
string
fractionAsString(value)
Converts a fraction to a string
source code
Variables [hide private]
  __package__ = 'flumotion.common'
Function Details [hide private]

gcd(a, b)

source code 

Returns the greatest common divisor of two integers.

Parameters:
  • a (int)
  • b (int

    @rtype : int

    )

fractionFromValue(value)

source code 

Converts a value to a fraction

Parameters:
  • value (one of
    • string, unicode
    • number, eg int/float/long
    • two sized tuple
    ) - the value to convert to a tuple
Returns: a two sized tuple with 2 integers
the fraction

fractionAsFloat(value)

source code 

Converts a fraction to a float

Parameters:
  • value (a two sized tuple with 2 integers) - the value to convert to a tuple, can be one of:
Returns: float
fraction representation in float

fractionAsString(value)

source code 

Converts a fraction to a string

Parameters:
  • value (a two sized tuple with 2 integers) - the value to convert to a tuple, can be one of:
Returns: string
fraction representation as a string