erhanbaris / smartcalc

Text based calculator for peoples
https://erhanbaris.github.io/smartcalc-app/
GNU General Public License v2.0
189 stars 7 forks source link

Inconsistent thousands separator, erroneous handling of decimal numbers #1

Closed matthew-e-brown closed 2 years ago

matthew-e-brown commented 2 years ago

When typing a currency, SmartCalc uses , for the thousands separator, and . for the decimal point, as is standard in both UK- and US-English.

$1800 is parsed as "$1 comma 800 dot 00"

However, when a regular number is used, . is used for the thousands separator.

1800 is parsed as "1 dot 800"

This is inconsistent, and creates confusion. The calculator also does its best to guess what the user wants when given numbers that have commas and periods in them, but it gets tripped up pretty badly.

See list above

Furthermore, when it comes to large, 1,000+ numbers that have decimal portions, the calculator seems to just spit out whatever it wants:

See list above


When it comes to fixing this issue, obviously the calculator must be made consistent, and should pick .-, or ,-.. For user-input, however... one could either enforce the same notation style that the calculator outputs, or it could do its best to figure out which is which from the user. For example, if there are less than three or more than four numbers after the separator, it is most likely a decimal point. However, if there are more occurrences of the same separator later in the number, then it is probably the thousands separator. The other can then be assumed for the decimal separator.

i18n is a nightmare... :smile:

Quackdoc commented 2 years ago

Could we use ' for digit seperator? not only do some people have troubles seeing the difference between , and . some fonts can greatly exacerbate this issue. and digit separators can differ greatly depending on country. using ' is not uncommon in computing either.

matthew-e-brown commented 2 years ago

Personally, I have never seen ' before. If this is meant to be a calculator "for people," I think sticking to combinations of , and . is for the best—being used in computing is only really going to mean something to people who work with computers. Most places in the world use some combination of , and ..

Quackdoc commented 2 years ago

that completely dismisses the problem instead of addressing it, many people with sight impairments can find issues telling the difference between periods and commas. if the point is to use a mark to denote digits, instead of just using a space, then something like an apostrophe would do better the SI explicitly says not to use periods or commas to denote digit intervals. an apostrophy is used to denote the presence of a space where it would otherwise not be possible (IE. simple physical calculators)

following SI being pretty much the only internationally accepted for of measurement would probably be a good idea.

matthew-e-brown commented 2 years ago

My only gripe was the lack of consistency (sometimes ,-., sometimes .-,), I never the considered hard-of-sight perspective.

I'm all for following SI conventions, I just don't know how many people use that in their day-to-day, which was my focus; I feel like more familiar would be better than more proper.

That's just me, though. I'm happy to concede. 🙂

erhanbaris commented 2 years ago

Sorry for the difference regarding the dot and comma separation. Previously, I thought of numbers and money types as different items and made arrangements accordingly. The easiest way to solve the problem will be to read the system locale configuration and apply those parameters. I will work on that. Thanks for sharing your thoughts.

erhanbaris commented 2 years ago

Changes are done, merged into master branch and updated web repository. Web browser's decimal and thousands separator is used. Please validate it then I will close issue.