(self, n_decimals, force_dot, group_digits)
return self._decimal_notation(
            digitstr, n_before-1, type_sign=b'', force_dot=force_dot, group_digits=group_digits
        )
Put a float in fixed-point representation.
Put a float in fixed-point representation.
Put a float in fixed - point representation .
def to_str_fixed(self, n_decimals, force_dot, group_digits):
        """Put a float in fixed-point representation."""
        if self.is_zero():
            if force_dot:
                return b'.' + b'0'*n_decimals
            if n_decimals:
                return b'0'*n_decimals
            return b'0'
        # convert to integer_mantissa * 10**exponent
        mantissa, exp10 = self.to_decimal()
        # -exp10 is the number of digits after the radix point
        n_after = -exp10
        # bring to decimal form of working precision
        if n_after > n_decimals:
            n_work = self.digits - (n_after - n_decimals)
            # this has n_work or n_work+1 digits, depending on rounding
            mantissa, exp10 = self.to_decimal(n_work)
            n_after = -exp10
        digitstr = b'%d' % (abs(mantissa),)
        # number of digits before the radix point.
        n_before = len(digitstr) - n_after
        # fill up with zeros to required number of figures
        digitstr = digitstr.ljust(n_decimals + n_before, b'0')
        return self._decimal_notation(
            digitstr, n_before-1, type_sign=b'', force_dot=force_dot, group_digits=group_digits
        )
def to_str_fixed ( self , n_decimals , force_dot , group_digits ) : if self . is_zero ( ) : if force_dot : return b'.' + b'0' * n_decimals if n_decimals : return b'0' * n_decimals return b'0' # convert to integer_mantissa * 10**exponent mantissa , exp10 = self . to_decimal ( ) # -exp10 is the number of digits after the radix point n_after = - exp10 # bring to decimal form of working precision if n_after > n_decimals : n_work = self . digits - ( n_after - n_decimals ) # this has n_work or n_work+1 digits, depending on rounding mantissa , exp10 = self . to_decimal ( n_work ) n_after = - exp10 digitstr = b'%d' % ( abs ( mantissa ) , ) # number of digits before the radix point. n_before = len ( digitstr ) - n_after # fill up with zeros to required number of figures digitstr = digitstr . ljust ( n_decimals + n_before , b'0' ) return self . _decimal_notation ( digitstr , n_before - 1 , type_sign = b'' , force_dot = force_dot , group_digits = group_digits )