Fix length calculation in integer-to-string conversion routine