Repository navigation
# Calculator groups digits in threes, so regions with lakh/crore grouping (e.g. en_IN) get the wrong answer
#1889
Replies: 1 comment 5 replies
|
@param1903 the approach is sound. but have you done regression test changing to dot comma if it respects macOS' default? changing different regions because it's all about comma and dot, actual calculates result is not wrong. |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Existing discussions
What happened?
My Mac's region is India (Language & Region →
en_IN, language English (India)), andSettings → General → Calculator → Number format is
System.Typing a large number is formatted with a comma every three digits, but Indian numbering groups
the last three digits and then every two:
20,00,000(twenty lakh), not2,000,000.20000002,000,00020,00,0001234567812,345,6781,23,45,678123456.78123,456.781,23,456.78So the answer is right but reads wrong —
2,000,000Steps to reproduce
uses lakh/crore grouping).
System.2000000. It shows2,000,000; it should show20,00,000.Screenshots or recording
The patch attached to this post is mine, and I've tested it against the current
main.It gives
CalcNumberFormatthe region's grouping widths (NumberFormatter.groupingSizeandsecondaryGroupingSize) next to the separators it already reads, then re-groups output in thosewidths and accepts the region's own grouping on input.
English and the separator-only regions (Italy, France, Switzerland) come out byte-for-byte the same
as before, and the copied text stays ungrouped.
Tests/CalcTests.swiftpasses, including new cases for the Indian widths.One thing I can't do: this machine has Command Line Tools but no Xcode, so I can't build the app or
record the before/after video the PR template asks for. Would you rather build it from the patch
yourself, or is a written before/after enough?
(Small note: the attached file is the plain diff, so
git applyrather thangit am— the committitle I used is "Group the calculator's numbers by the region's widths".)
Tinycast version + channel
0.12.12-beta.139(Beta)macOS version
27.2(build 26B123), Apple siliconAll reactions