Fix two Format() overflows

- #736: overflow when scaling down to a 19-digit number that is greater than 2^63
- overflow when scaling a tiny value up by 10^309 or higher (max is 10^308).