Page 1 of 2

[5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 5:52 pm
by Little John
New function:

Code: Select all

number$ = FormatNumber(Number.d [, NbDecimals [, DecimalPoint$ [, ThousandSeperator$]]])
According to the help, the default character used as thousands separator is a comma ",".
[u]Wikipedia[/u] wrote:Since 2003, the use of spaces as separators (for example: 20 000 and 1 000 000 for "twenty thousand" and "one million") has been officially endorsed by SI/ISO 31-0 standard, as well as by the International Bureau of Weights and Measures and the International Union of Pure and Applied Chemistry, the American Medical Association's widely followed AMA Manual of Style, and the Metrication Board, among others.
Just a small feature request: Please use one space character as default thousands separator.

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 5:57 pm
by DontTalkToMe
-1
Comma is the default used by US locale, and BASIC itself use the USA locale for its string formatting functions.
I would prefer to have "," as default as it is now, and also to have a visible char instead of an invisible one.

btw: I wonder why they decided to add this (which is a trivial function you can write by yourself) instead of something along the lines of print using with char masks etc.
At least that could be used for anything, not just numbers, and it's not so trivial to write.
I find this a missed opportunity. :shock:

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 7:34 pm
by Tenaja
Little John wrote:Just a small feature request: Please use one space character as default thousands separator.
This does not make sense, because in the US, numbers separated by a space are considered separate, unrelated numbers. It is so engrained that without using either a comma or nothing, even the decimal point of europe is confusing because we do not know if it is referring to a thousand separator or a number less than zero.

Knowing we are not the center of the world, PB has to choose something to standardize on. Perhaps a compiler setting could choose the locale. Otherwise, a consistent location must be chosen for standardization.

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 7:38 pm
by ts-soft
My wish is, using the local user-system-settings as default, like comma in usa and dot in german for thousands separator,
and comma as DecimalPoint in german, dot in usa.

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 7:52 pm
by Little John
Tenaja wrote:Knowing we are not the center of the world, PB has to choose something to standardize on.
That's right.
And the recommendation of the International Bureau of Weights and Measures (see my first post) seems to be the best choice IMHO.

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 10:17 pm
by DontTalkToMe
ts-soft wrote:My wish is, using the local user-system-settings as default, like comma in usa and dot in german for thousands separator,
and comma as DecimalPoint in german, dot in usa.
My suggestion is to leave all as it is now, with "," and "." as defaults, like BASICs already do and expect for VAL(), STR() and similar functions and to implement two native cross platform functions to retrieve the OS specific decimal separator (",") and digit grouping symbol (".") to use where and if required.

Also those functions could be useful well beyond this simple command.

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 10:27 pm
by Little John
DontTalkToMe wrote:My suggestion is to leave all as it is now, with "," and "." as defaults, like BASICs already do and expect for VAL(), STR() and similar functions
Val(), Str(), and similar functions do not handle thousands separators at all.

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 10:30 pm
by DontTalkToMe
I know, and it's not relevant to what I said, but thanks anyway. :D

The point was BASICs functions follow the USA locale conventions.

I said my piece, nothing to add. :wink:

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 10:35 pm
by Little John
DontTalkToMe wrote:I know, and it's not relevant to what I said, but thanks anyway. :D
The problem is: What you said is not relevant to this topic, but thanks anyway. :D

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 10:37 pm
by DontTalkToMe
That's your opinion, my suggestions are extremely more useful beyond this specific topic and forward looking then yours, but thanks anyway :lol:

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 10:43 pm
by Little John
DontTalkToMe wrote:my suggestions are extremely more useful beyond this specific topic and forward looking then yours
Yes of course, there's no doubt about it. You are my hero!
Image

Re: [5.50] FormatNumber() thousands separator

Posted: Mon Jun 06, 2016 10:44 pm
by DontTalkToMe
Hope for your sake you are being sincere :mrgreen:

Re: [5.50] FormatNumber() thousands separator

Posted: Tue Jun 07, 2016 5:46 am
by TI-994A
Tenaja wrote:...PB has to choose something to standardize on.
ts-soft wrote:My wish is, using the local user-system-settings as default...
Let's bear in mind that this is simply a convenience function, and not a localisation setting. The team has simply set the period and the comma as the defaults for this new function. :wink:

Re: [5.50] FormatNumber() thousands separator

Posted: Tue Jun 07, 2016 10:48 am
by Dude
Little John wrote:Please use one space character as default thousands separator.
I say: use what the OS uses. For Windows:

Code: Select all

sep$=Space(9)
GetLocaleInfo_(#LOCALE_USER_DEFAULT,#LOCALE_STHOUSAND,sep$,Len(sep$))
Debug sep$ ; Shows a comma on my English US version of Windows.
Tenaja wrote:PB has to choose something to standardize on.
I agree, which is why it should use the default OS thousands separator, as I just mentioned. Makes perfect sense and stops any arguing. ;)

Re: [5.50] FormatNumber() thousands separator

Posted: Tue Jun 07, 2016 11:11 am
by ts-soft
@Dude

+1 (it is the same as what i say with my thread)