def division(
       cls,
       divisor,
       dividend,
       base,
       precision=None,
       method=RoundingMethods.ROUND_DOWN
      ):
        """
        Division of natural numbers.

        :param divisor: the divisor
        :type divisor: list of int
        :param dividend: the dividend
        :type dividend: list of int
        :param precision: maximum number of fractional digits
        :type precision: int or NoneType
        :param method: rounding method
        :type method: element of RoundignMethods.METHODS
        :returns: the result
        :rtype: tuple of list of int * list of int * list of int * int
        :raises ConvertError: on invalid values

        The last value in the result indicates the relationship of the
        result to the actual value. If 0, it is the same, if 1, greater,
        if -1, less.

        Complexity: Uncalculated
        """
        # pylint: disable=too-many-arguments

        if base < 2:
            raise BasesValueError(base, "base", "must be at least 2")

        if precision is not None and precision < 0:
            raise BasesValueError(precision, "precision", "must be at least 0")

        if any(x < 0 or x >= base for x in divisor):
            raise BasesValueError(
               divisor,
               "divisor",
               "for all elements, e, 0 <= e < base required"
            )

        if any(x < 0 or x >= base for x in dividend):
            raise BasesValueError(
               divisor,
               "divisor",
               "for all elements, e, 0 <= e < base required"
            )

        if all(x == 0 for x in divisor):
            raise BasesValueError(
               divisor,
               "divisor",
               "must be greater than 0"
            )

        divisor = Nats.convert_to_int(divisor, base)

        (integer_part, rem) = cls._division(divisor, dividend, 0, base)
        (carry, non_repeating_part, repeating_part, relation) = \
           cls._fractional_division(
              divisor,
              rem,
              base,
              precision,
              method
           )

        (carry, integer_part) = Nats.carry_in(integer_part, carry, base)

        return (
           list(itertools.dropwhile(lambda x: x == 0, [carry] + integer_part)),
           non_repeating_part,
           repeating_part,
           relation
        )
def division ( cls , divisor , dividend , base , precision = None , method = RoundingMethods . ROUND_DOWN ) : if base < 2 : raise BasesValueError ( base , "base" , "must be at least 2" ) if precision is not None and precision < 0 : raise BasesValueError ( precision , "precision" , "must be at least 0" ) if any ( x < 0 or x >= base for x in divisor ) : raise BasesValueError ( divisor , "divisor" , "for all elements, e, 0 <= e < base required" ) if any ( x < 0 or x >= base for x in dividend ) : raise BasesValueError ( divisor , "divisor" , "for all elements, e, 0 <= e < base required" ) if all ( x == 0 for x in divisor ) : raise BasesValueError ( divisor , "divisor" , "must be greater than 0" ) divisor = Nats . convert_to_int ( divisor , base ) ( integer_part , rem ) = cls . _division ( divisor , dividend , 0 , base ) ( carry , non_repeating_part , repeating_part , relation ) = cls . _fractional_division ( divisor , rem , base , precision , method ) ( carry , integer_part ) = Nats . carry_in ( integer_part , carry , base ) return ( list ( itertools . dropwhile ( lambda x : x == 0 , [ carry ] + integer_part ) ) , non_repeating_part , repeating_part , relation )
Division of natural numbers.

        :param divisor: the divisor
        :type divisor: list of int
        :param dividend: the dividend
        :type dividend: list of int
        :param precision: maximum number of fractional digits
        :type precision: int or NoneType
        :param method: rounding method
        :type method: element of RoundignMethods.METHODS
        :returns: the result
        :rtype: tuple of list of int * list of int * list of int * int
        :raises ConvertError: on invalid values

        The last value in the result indicates the relationship of the
        result to the actual value. If 0, it is the same, if 1, greater,
        if -1, less.

        Complexity: Uncalculated