avoid repetition in calcDigitSize