fix(numbers): correctly determine malformed decimals by olunusib · Pull Request #1042 · python-babel/babel
Fixes #928
Problem:
The current code was primarily designed for numbers like 3,400.00, where the r-stripped value (3,400.) matches the expected proper (3,400) + . (3,400.) format. It doesn't work for numbers like 3,400.60 since 3,400.6 (the value after r-stripping) is incorrectly perceived as not equal to the expected format, which is the proper (3,400.6) + . (3,400.6.), thereby leading to its erroneous detection as improperly formatted.
Solution:
Added a more robust method for stripping trailing zeros, specifically targeting only those zeros that appear after the last non-zero digit following the decimal symbol.