pricing/babel_numbers.py
def scientific_notation_elements(self, value, locale):
        """ Returns normalized scientific notation components of a value."""
        # Normalize value to only have one lead digit.
        exp = value.adjusted()
        value = value * get_decimal_quantum(exp)
        assert value.adjusted() == 0

        # Shift exponent and value by the minimum number of leading digits
        # imposed by the rendering pattern. And always make that number
        # greater or equal to 1.
        lead_shift = max([1, min(self.int_prec)]) - 1
        exp = exp - lead_shift
        value = value * get_decimal_quantum(-lead_shift)

        # Get exponent sign symbol.
        exp_sign = ''
        if exp < 0:
            exp_sign = babel.numbers.get_minus_sign_symbol(locale)
        elif self.exp_plus:
            exp_sign = babel.numbers.get_plus_sign_symbol(locale)

        # Normalize exponent value now that we have the sign.
        exp = abs(exp)

        return value, exp, exp_sign
def scientific_notation_elements(self, value, locale):
        # Normalize value to only have one lead digit.
        exp = value.adjusted()
        value = value * get_decimal_quantum(exp)
        assert value.adjusted() == 0

        # Shift exponent and value by the minimum number of leading digits
        # imposed by the rendering pattern. And always make that number
        # greater or equal to 1.
        lead_shift = max([1, min(self.int_prec)]) - 1
        exp = exp - lead_shift
        value = value * get_decimal_quantum(-lead_shift)

        # Get exponent sign symbol.
        exp_sign = ''
        if exp < 0:
            exp_sign = babel.numbers.get_minus_sign_symbol(locale)
        elif self.exp_plus:
            exp_sign = babel.numbers.get_plus_sign_symbol(locale)

        # Normalize exponent value now that we have the sign.
        exp = abs(exp)

        return value, exp, exp_sign
def scientific_notation_elements ( self , value , locale ) : # Normalize value to only have one lead digit. exp = value . adjusted ( ) value = value * get_decimal_quantum ( exp ) assert value . adjusted ( ) == 0 # Shift exponent and value by the minimum number of leading digits # imposed by the rendering pattern. And always make that number # greater or equal to 1. lead_shift = max ( [ 1 , min ( self . int_prec ) ] ) - 1 exp = exp - lead_shift value = value * get_decimal_quantum ( - lead_shift ) # Get exponent sign symbol. exp_sign = '' if exp < 0 : exp_sign = babel . numbers . get_minus_sign_symbol ( locale ) elif self . exp_plus : exp_sign = babel . numbers . get_plus_sign_symbol ( locale ) # Normalize exponent value now that we have the sign. exp = abs ( exp ) return value , exp , exp_sign
Returns normalized scientific notation components of a value.
Returns normalized scientific notation components of a value .