News for hackers. Stuff that matters.
Re: by drpixie on Thursday February 27, 2025 @03:16AM (#43192351)
> Initially I thought to use , for float but ended use using . for floats.

Better - check the computer's region setting and use the local language convention, so decimal point is "." is English speaking regions, and "," is Euro regions, and who knows what else in other regions. That way code might work in one location but fail in another ;)

Re: by SirusCodes on Thursday February 27, 2025 @03:36AM (#43192439)
Is that true? I thought for all languages only "." is defacto decimal point in all languages. Never knew it changes with locale.
Re: by smatija on Thursday February 27, 2025 @04:12AM (#43192604)
Cyprus and Peru use , for decimal point for non-currency amounts and . for decimal point with currency amount. So it's not even consisent inside some languages.

See https://en.wikipedia.org/wiki/Decimal_separator#Hindu%E2%80%...

Re: by SirusCodes on Thursday February 27, 2025 @06:04AM (#43193248)
That's painful to think about
Re: by plopilop on Thursday February 27, 2025 @03:41AM (#43192461)
The hegemony of software only accepting . has de facto pushed the standard everywhere for computers, but here in France I still write with a comma, but type with a dot.

A few years ago Excel and some other softwares started to be locale dependent and I never wanted to burn my computer this much

Re: by johncoltrane on Thursday February 27, 2025 @08:03AM (#43194006)
French dev currently working for a French but global client, here. The UI of the timesheet app is in English but the fields only accept `,` as decimal point. It's so needlessly confusing.
Re: by bayindirh on Thursday February 27, 2025 @09:21AM (#43194610)
That's one of the great boons of localization. The webapp knows you're in France, so it tries to do the right thing, while giving you a US English UI. I experience the same thing, but got used to it somehow.

Another good example is how "İ" is popping up everywhere, even in English, because of misconfigured locale settings and how changing case is affected by it. We (Turks) are responsible for that, sorry (We have ı,i,I,İ =D ).

Re: by kolinko on Thursday February 27, 2025 @04:10AM (#43192598)
It’s “,” in Poland, and a dot(or apostrophe) as thousands separator.

That’s why in region settings on your computer you will find not only date/tome formatting, but also the number format.

Re: by spacechild1 on Thursday February 27, 2025 @04:06AM (#43192582)
For example, German speaking countries use a comma instead of a decimal point, whereas the latter is used as a group separator. The German word for decimal place is "Kommastelle" (= "comma place").
Re: by jiehong on Thursday February 27, 2025 @03:54AM (#43192521)
Very much so.

Dot is often used as thousands separator too.

I remember the first time I saw 10,000 as a price and thought: 10 bucks? So cheap. But also: who needs 3 decimal points for a price?

Looks like its more or less 50% of the world [0].

[0]: https://en.wikipedia.org/wiki/Decimal_separator#Conventions_...

Re: by koliber on Thursday February 27, 2025 @04:27AM (#43192676)
To add to the complexity of the whole situation, some countries don't separate by thousands (every three zeroes). India uses a 2,2,3 system (crore, lakh, thousand).

10 million = 1,00,00,000

https://en.wikipedia.org/wiki/Lakh

Re: by rob74 on Thursday February 27, 2025 @07:51AM (#43193935)
> who needs 3 decimal points for a price?

Petrol stations... I have no idea how widespread this practice is, but at least in Germany fuel prices have 3 decimal points to better confuse motorists. The third number is usually displayed smaller and is of course always a nine. So, if you see the price for a litre of diesel at e.g. 1.62⁹ €, you might forget to round it up mentally.

Re: by yxhuvud on Thursday February 27, 2025 @03:52AM (#43192519)
No. Some languages use . for thousand (or even hundred) separators.
Re: by ninalanyon on Thursday February 27, 2025 @07:28AM (#43193757)
International standards say that either dot or comma is acceptable as decimal separator and thousand separators are optional spaces, typically a half space when properly typeset.

    ISO 31-0 (after Amendment 2) specifies that "the decimal sign is either the comma on the line or the point on the line". This follows resolution 10[1] of the 22nd CGPM, 2003.[2]

    For example, one divided by two (one half) may be written as 0.5 or 0,5.
Re: by seafoamteal on Thursday February 27, 2025 @03:30AM (#43192414)
Good idea, but I suggest swapping . and , regions keeping with the spirit of the language.
Re: by SirusCodes on Thursday February 27, 2025 @06:06AM (#43193255)
This is pure evil idea :)

I will implement this thing.

Re: by SirusCodes on Thursday February 27, 2025 @06:23AM (#43193356)
Re: by andrelaszlo on Thursday February 27, 2025 @06:16AM (#43193320)
This is so evil it has already been implemented by Microsoft (Excel sheets...)
Re: by Jotalea on Thursday February 27, 2025 @07:49AM (#43193922)
No surprise to see that coming from microsoft.
Re: by gryn on Thursday February 27, 2025 @12:25PM (#43196429)
yeah, to keep it in spirit also add localization of function/operator names and make sure only the locale version works not all at the same time.
Re: by bayindirh on Thursday February 27, 2025 @07:41AM (#43193864)
This is on par with how Java WebStart locale reporting works between Windows and Linux.

AFAIR, Windows always reports US_EN for the locale, so you can write locale unaware code everywhere, but when running on Linux, you get the correct locale of the system (of course), and things break spectacularly.

I remember debugging an integer overflow, and I literally facepalmed following a "you didn't do THAT, did you!?".

The thing they did was parsing the date from the date string (formatted for system locale, without giving a specific locale) Java returned to them instead of fixing the locale and getting the date or getting the parts with relevant functions.

I have a relatively short fuse for people who doesn't read (or at least skim) the manual of the library they're using.