Use static_cast on digit.
make pretty
Instead of checking something like `x * y + z > max` where `x * y` can overflow, check for `x > (max - z) / y` instead.