Repository navigation
fix(number): preserve digits in large decimal strings in intcomma - #502
Closed
KUMAR-AKASH-M wants to merge 4 commits into
Closed
KUMAR-AKASH-M wants to merge 4 commits into
KUMAR-AKASH-M wants to merge 4 commits into
Conversation
added 4 commits
November 3, 2026 00:32
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #496.
intcomma('1234567890123456.78') returned '1,234,567,890,123,456.8' because the string branch converted decimal strings through float(). When no rounding is requested (ndigits is None), plain decimal strings are now parsed with Decimal, matching the existing Decimal input path, so grouping retains the input digits. Behaviour is deliberately unchanged when ndigits is given (rounding still uses float formatting), and for exponent/trailing-dot strings (still float).
One behaviour note: intcomma('14308.40') now returns '14,308.40' instead of '14,308.4', consistent with intcomma(Decimal('14308.40')); trailing zeros are input digits, not rounding.
Tests: added regression cases to tests/test_number.py. Verified locally: all 244 tests in tests/test_number.py pass (36 intcomma tests before the new cases, 244 total after adding them), including the issue repro.
No CLA, screenshot, or device test is involved; this is a pure-Python formatting fix.