Comma's in numbers.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Korolev Michael
Enthusiast
Enthusiast
Posts: 200
Joined: Wed Feb 01, 2012 5:30 pm
Location: Russian Federation

Re: Comma's in numbers.

Post by Korolev Michael »

Digit group mark must be acquired from system settings. Think, PB team doesn't wish to implement this because this is real headache.
Former user of pirated PB.
Now registered user :].
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Comma's in numbers.

Post by Little John »

Korolev Michael wrote:Digit group mark must be acquired from system settings.
No, certainly not.
PB code must be exactly the same for all PB users in all countries.
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Comma's in numbers.

Post by skywalk »

Ha! I never knew Macro x(a=,b=) was valid :shock:
Since calling it does not allow empty parameters...
x(,2) fails. :(
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Korolev Michael
Enthusiast
Enthusiast
Posts: 200
Joined: Wed Feb 01, 2012 5:30 pm
Location: Russian Federation

Re: Comma's in numbers.

Post by Korolev Michael »

Are we regarding comma as a part of code? Or as additional info tip?
Former user of pirated PB.
Now registered user :].
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Comma's in numbers.

Post by Little John »

Danilo wrote:
freak wrote:Just use a macro:

Code: Select all

Macro Num(a=,b=,c=,d=,e=,f=)
  a#b#c#d#e#f
EndMacro


Debug Num(1,000)
Debug Num(1,000,000)
Nice idea, if you want to use comma ',' as thousands separator (english notation).
I certainly do not want to write e.g.

Code: Select all

x = Num(53,214,589) * Num(45,212,547)
And using commas is not a good idea anyway, for the reasons that have been mentioned at the beginning of this thread.
For those reasons, the space is recommended as digit group separator in the SI/ISO 31-0 standard.
And
Wikipedia (see link above) wrote:Other style-defining bodies are also moving toward this clearer notation. For example, the International Union of Pure and Applied Chemistry (IUPAC) suggest never using a comma or a point as thousands separator: "For numbers with many digits, the digits may be separated in groups of three, counting from the decimal sign toward the left and the right. The groups should be separated by a thin space (half space), and never by a comma or a point, or by any other means."[14] The American Medical Association, whose AMA Manual of Style is widely followed in health professions literature, also endorses a space for the digit group separator.[11] (Specifically, a thin space is endorsed for typesetting; a regular word space is sufficient wherever typographical nicety is impractical.) The United Kingdom Metrication Board also proposed this system for Metrication in the United Kingdom and, while not universally adopted, it is the standard in the UK construction industry.
Since in programming languages (as well as with command-line arguments etc.) spaces mostly are used as separators, it's an old and well established practice to use the underscore '_'. where no separator is intended, but where it shall look almost like a space. Underscores can already be part of identifiers in PB, so why couldn't they be part of numbers? :-)
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: Comma's in numbers.

Post by Seymour Clufley »

I just want to point out that, in the thread title, "comma's" should not have an apostrophe. The plural of "comma" is "commas".
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Post Reply