'Ensure that there are no more than max_digits in the number, and no
more than decimal_places digits after the decimal point.
Override this method to disable the precision validation for input
values or to enhance it in any way you need to.'

def validate_precision(self, value):

    (sign, digittuple, exponent) = value.as_tuple()
    if (exponent >= 0):
        total_digits = (len(digittuple) + exponent)
        whole_digits = total_digits
        decimal_places = 0
    elif (len(digittuple) > abs(exponent)):
        total_digits = len(digittuple)
        whole_digits = (total_digits - abs(exponent))
        decimal_places = abs(exponent)
    else:
        total_digits = abs(exponent)
        whole_digits = 0
        decimal_places = total_digits
    if ((self.max_digits is not None) and (total_digits > self.max_digits)):
        self.fail(u'max_digits', max_digits=self.max_digits)
    if ((self.decimal_places is not None) and (decimal_places > self.decimal_places)):
        self.fail(u'max_decimal_places', max_decimal_places=self.decimal_places)
    if ((self.max_whole_digits is not None) and (whole_digits > self.max_whole_digits)):
        self.fail(u'max_whole_digits', max_whole_digits=self.max_whole_digits)
    return value
