# dot vs comma for decimal point

I know that in certain countries the use of “.” and “,” are swapped. where in the US it might be “1,000.00” elsewhere it might be “1.000,0”, am I right?

If so, are physical calculators in other countries set up to work that same way? (have a comma key in place of a period key?)
or do all calcuators worldwide conform to the same way of doing things?

This was an issue I had not even considered until designing a calculator UI recently.

My German iPhone calculator app gives the result of the addition of 2000 + .27 (entered as “2000 + 0,27”) as “2.000,27”, as it is correct in German. I don’t use other calculators, but I am shure, that many German calculators express numbers the same way.

Edit: Wrong calculation in first post.

so the keyboard had a [comma , ] key but not a [dot/period .] key

correct, this is how the Apple native macOS calculator app is looking on a German macOS.

Thanks… I tried to change my system setting to see if that is what happened, but couldn’t get the changes to stick they kept reverting back

@Dave S  In France, and more generally in Europe, I don’t remember having ever seen a number with both thousands separator and decimal digits (except in IT). It is OK to see 20.000.000 or 3,14159 but for large decimal numbers I have usually seen a thin space to replace the dot, e.g. 20?000,89.

Also on French keyboards, aka AZERTY, the dot on the num keypad is replaced by a comma and becomes a dot with the shift key.

dim Zahl as double = 1234.56
xx.Text=Format(Zahl*10,"#,##0.00")

= 1.1234,56

Not sure this answers the question.
Given that (surely) the majority of actual calculators are made in Japan or China, and then shipped around the world, do they ship special builds to each country?
If not, then I would imagine a physical calculator always shows 3.14159 for PI
On a computer or a phone, its different, naturally

@Jeff Tulin  Yes I think that many products are actually designed to be sold only to some countries. They don’t always have different designs or components, but different firmwares.

For example, in France, pocket calculators must have a special “exam setting” for the final exam before college so manufacturers had to adapt the firmware

The main reason for asking the question was to determine what the EXPECTATION of a computer (or iPhone) based calculator would be… seeing as MOST (or so it seems) calculators/apps use the “dot”… I’m not going to go to the extra complexity this time

its trivial to figure out which to show in a UI

``````Dim decimalStr As String = ReplaceAll(Format(1.1, "0.0"),"1","")
Dim thousandsStr As String = ReplaceAll(Format(1111, "0,000"),"1","")``````

display the decimal str and then just use an appropriate format string to show the result and its all localized

usually switching language will do it as it also switches to use the normal formats associated with that language
but you do have to restart your app each time

@Dave S  Well, if you use the right functions in Xojo (i.e. the ones that take into account the locale), you should always end up with the right result, e.g. using CStr instead of Format.

it is much more complex than that, as this app does not accept “simple” numbers… any input by the user needs to be parsed and interpeted, and finally converted to and/or from a double. CStr or Format are not able to address the specific situations

Plus since this deals with Imperial measurements anyways… its doubtful that enough (any) people would be impacted.

It was just a curiousty question… and thanks to all who responded

@Dave S  Imperial measurements? Of course, 2 ?" is so much easier!.. oh damn, I am such a naughty person!

for construction work, I bet it is… but not here to debate the benefits or detrements of Imperial vs Metric

Format and CDbl should be used as a pair if you accept and show internationally savvy values

Str (optionally with a format string) and Val if you only accept and show C style (comma for thousands and period for decimals) - or “US English format”

But thats not relevant here if Dave’s showing 2 ? which is still widely used in the construction industry in Canada which is supposedly metric. The mish mash of some metric and some imperial is so fun. I have 2 sets of everything. Sockets, wrenches and all kinds of other tools - one imperial and one in metric

Cheap physical calculators just have a dot, scientific physical calculators have options to change grouping and Decimal Separators, Software calculators, is up to the developper, use the locale, or make it as an option.

``````
Dim locale As Xojo.Core.Locale = Xojo.Core.Locale.Current
DecimalButton.Caption = locale.DecimalSeparator
``````

Oh, you have missed Switzerland
I would expect the number to be presented to me like this: `1'000.0` (and the iOS Calculator.app does this of course)

If data entry is only possible using custom UI (Buttons), then again: I would expect the “localized Decimal Separator” in the “data entry buttons”. And a localized output for numbers shown.

For some “specialized application” i would understand and accept if it’s not localized… and just displays the US format.

The real fun begins if data entry is possible using the Keyboard… Then I’m quite sure users will enter “their (localized) decimal separator”, even if the application doesn’t localize numbers otherwise.