Refactored min/max digit options handling

Moved range validation to its own module, as well as percent and per
mille pattern checks as their own util. Added a few more tests to test
min/max fraction digits.