18
Astatos
4y

I started thinking and worrying about numbers much more than before

in the US, you write numbers like this:
1,000.00
in Germany usually like this:
1.000,00
and in programming languages like this:
1000.00

now i wonder how to type a number, whenever i have to use german software
should i use the US way, the german way or the dev way? the wrong one could possibly break it

Comments
  • 7
    Sometimes, depending on the programming language, I write numbers with underscores e.g 1_000 or 1_000_000
  • 2
    My issue is that I need to deal with 23 different currencies and format them to the user... There are surprisingly a lot of combinations, formats and characters
  • 1
    And in Slovakia we do:
    1 000,00

    I actually think spaces make the most sense for thousand spearators. For decimals I don't care.
    But why can't there be a standard way ?!
  • 1
    India 11,10,00,000.01
  • 2
    Swiss 123'456'789.00
  • 0
    Latvia 123'455'789,00
    But the thousands seperator is not mandatory.
  • 2
    @CogInTheWheel Luckily, most programming languages have good libraries to do datetime formatting, currency and number representations.

    For web stuff it's float in db (optionally two fields, like amount and currency_type), float in backend, and then depending on your convictions you either serve a formatted string (add symbols, round etc) or let the frontend handle it.

    The other way around (user input) you assume they enter a float, preferably helping them with some visual aids, then sanitize only if you can be certain of meaning, and reject the rest in backend validation.
  • 1
    Let's make this a standard, 1,0,0,0,0,0.0,0
  • 0
    If you are USING software, you should use your current locale way of formatting numbers. If that doesn't work, use the locale of the software's company (generally US/UK way), because they probably didn't use a good library.

    If you are DEVELOPING software, use a library that handle locales for you. I know iOS and Android handle that pretty well, I guess you can find good library for every OS / language.
  • 0
    Use scientific notation. You can never go wrong
  • 0
    1) Just force the end user to apply to a certain kind of input.
    .
    .
    .
    ?) Profit
Add Comment