Support exponents with three digits

For "%e" and "%g" conversions, support exponents larger than 99 and
smaller than -99.

This commit is based on a patch provided by Paul Ramsey.  Thanks to him
and to Yury Vishnevski for reporting the issue.