Fix bug causing extra padding for numbers

+ calculate number of digits in decimal correctly