pyspeedup/algorithms/_divideMod.py
def _dM(numerator,denominator,modulo):
    '''A recursive helper function for use in dividing.'''
    (q,r)=divmod(modulo,denominator) #Python native function that performs Euclidean division.
    if r==0:
        if numerator%denominator!=0: #Then the does not divide the numerator, and thus...
            raise Exception("There is no solution in the given set of integers.")
        return (0,numerator//denominator)
    prev,solution=_dM(numerator,r,denominator)
    #Python syntax for quick value reassignment, which allows for swapping without a temporary variable.
    prev,solution=-solution,-(prev+q*solution) #Negatives account for sign change in algorithm lazily.
    return prev,solution
A recursive helper function for use in dividing.
A recursive helper function for use in dividing.
A recursive helper function for use in dividing .
def _dM(numerator,denominator,modulo):
    (q,r)=divmod(modulo,denominator) 
    if r==0:
        if numerator%denominator!=0: 
            raise Exception("There is no solution in the given set of integers.")
        return (0,numerator//denominator)
    prev,solution=_dM(numerator,r,denominator)
    prev,solution=-solution,-(prev+q*solution) 
    return prev,solution
def _dM ( numerator , denominator , modulo ) : ( q , r ) = divmod ( modulo , denominator ) if r == 0 : if numerator % denominator != 0 : raise Exception ( "There is no solution in the given set of integers." ) return ( 0 , numerator // denominator ) prev , solution = _dM ( numerator , r , denominator ) prev , solution = - solution , - ( prev + q * solution ) return prev , solution
A recursive helper function for use in dividing.
A recursive helper function for use in dividing .
'''A recursive helper function for use in dividing.''' #Python native function that performs Euclidean division. #Then the does not divide the numerator, and thus... #Python syntax for quick value reassignment, which allows for swapping without a temporary variable. #Negatives account for sign change in algorithm lazily.
numerator
denominator
modulo