User:Jimp/sandbox2
Grouping of digits
[edit]Acceptable number formats
[edit]According to wide-spread use on Wikipedia and in written English in general and to what seems to be long-standing consensus there are two basic ways of delimiting numbers: with commas and with thin spaces. Each of these have two variants giving four styles of grouping as follows.
- 1a) Separate four or more digits to the left of the decimal into groups of three using commas. Don't group digits to the right.
- 1b) Separate five or more digits to the left of the decimal into groups of three using commas. Don't group digits to the right.
- 2α) Separate digits both sides of the decimal into groups of three using thin spaces, except that a space should not be added if it leaves a lone digit on the left.
- 2β) Separate digits both sides of the decimal into groups of five using thin spaces.
It's a well-established principle that grouping style should be consistent throughout a given article but what exactly does this mean? Obviously we don't want one style to the left and another to the right of the decimal point. I think it also goes without saying that if we're using commas we shouldn't use spaces and vice-versa. Also, we should be consistent with regard to whether to delimit exactly four digits to the left. However, since grouping by fives is intended only for numbers with very many digits we should not have to use this style throughout an article simply because we use it once. Therefore consistency would mean a choice between using 1a, using 1b and using one or both of 2α and 2β.
The current wording
[edit]It seems that the above is the intended meaning of the text of Grouping of digits, which is as follows.
- Left of the decimal point: Five or more digits should be grouped (and exactly four digits may optionally be grouped) into triples separated by commas (never period/full stop): 12,200; 255,200; 8,274,527; 1,250 (optionally 1250).
- Exception: never group four-digit page numbers or four-digit calendar years (not sailed in 1,492, though 10,400 BC).
- In scientific/engineering articles, long strings left of the point may be grouped into triples without commas: 8274527
- Right of the decimal point: Five or more digits may be grouped into triples without commas: 99.123456.
- In mathematics-oriented articles, digits right of the point may be grouped into fives: 3.14159265358979323846....
Grouping style should be consistent throughout a given article.
Markup: Templates {{val}}
, {{val/delimitnum}}
, {{gaps}}
, and {{gapnum}}
may be useful in grouping digits. Use of hard-coded spaces, such as the regular space character, the non-breaking space (
or {{space}}
), and the thin space ( 
or {{thinsp}}
), is problematic for screen readers because they read out each group of digits as separate numbers (e.g. 30 000 is read as "thirty zero zero zero").
However, I don't think that this is made clear. By looking at the left and right sides separately it would appear that hybrid styles are allowed. For example, it seems to permit a number with commas to the left and spaces to the right (e.g. 12,345.67890) or spaces to the left and no delimitation to the right (e.g. 12345.67890). To make matters worse, it's suggesting an inconsistent grouping of digits in mathematical articles; digits are allowed to be grouped by fives to the right but not the left of the point (e.g. 12345678.90123456789012345678).
Of course, it should be obvious that delimiting style should be consistent both sides of the decimal point but I don't think that the current text makes it obvious and it should. The problem arises, it seems to me, that the current text doesn't exactly define what a style is (or misdefines it). I don't think that this is just some kind of non-issue; I've seen, for example, a suggestion that MOSNUM is recommending 12,345.67890. So, I'd suggest that the text be rewritten to make it clear what is and what is not acceptable.
An unreasonable ban on thin spaces
[edit]The current text restricts the use of thin spaces (left of the decimal) to scientific/engineering articles. However, I don't believe that this truly reflects use in the real world out there. A few months ago, Dbfirs]] mentioned that the use of thin spaces for thousands separators is what's taught in British schools. It's also quite normal in Australia. Furthermore, this is the style recommended by the SI.[1] Why, then is MOSNUM suggesting that this style may only be used in scientific/engineering articles? It should be preferred in such articles but allowed in any.
Mark up
[edit]There are a couple of questionable suggestions regarding mark up. Currently, the text is suggesting the use of {{val/delimitnum}}
. This is a subtemplate of {{val}}
and as such we shouldn't be encouraging it's use in the article space. It also suggests {{gapnum}}
but this somewhat obscure template should probably be merged with {{val}}
.
There is a hidden comment here which goes "perhaps should say something more re nbsp here since some will hand-code the markup; also, should and use nbsp? (answer may be different left of the point vs right of the point)". I wonder what more we might say about and, no, neither {{val}}
nor {{gaps}}
should use and the answer should be the same either side of the decimal point. Firstly, is too wide, the spaces should be thin; secondly, as noted, causes problems for screen readers it also causes problems when copying and pasting numbers into a calculation program (e.g. Excel).
Proposal
[edit]I'm proposing a rewrite of the section to clarify what is and what is not acceptable and where.
- Digits should be grouped and separated either by commas or thin spaces (never a period/full stop).
- Grouping with commas
- Left of the decimal point, five or more digits should be grouped (and exactly four digits may optionally be grouped) into threes separated by commas (e.g. 12,200, 255,200, 8,274,527 and either 1,250 or 1250).
- Right of the decimal point, do not group digits.
- Markup: Generally this is hard-coded; however,
{{formatnum:}}
may be used to produce this formatting in templates.
- Grouping with thin spaces
- Digits are grouped both side of the decimal point e.g. (e.g. 6543210.123456).
- Digits are grouped into threes or fives.
- Digits should generally be grouped into threes; however, right of the decimal point, the final group of digits should not be a single digit. Instead add the final digit to the preceding group (e.g. 99.1234567).
- For numbers with a large number of digits in mathematics-oriented articles, digits may be grouped into fives (e.g. 3.14159265358979323846...).
- This style is especially recommended for articles related to science, technology, engineering or mathematics.
- Markup: Templates
{{val}}
or{{gaps}}
may be used to produce this formatting. the use of hard-coded spaces, such as the regular space character, the non-breaking space (
or{{space}}
), and the thin space ( 
or{{thinsp}}
), is problematic for screen readers because they read out each group of digits as separate numbers (e.g. 30 000 is read as "thirty zero zero zero").
- Delimiting style should be consistent throughout a given article.
- Either use commas or thin spaces.
- Either delimit exactly four digits left of the decimal point or do not.
- However, grouping by threes and fives may coexist.
- An exception is made for four-digit page numbers or four-digit calendar years. These should never be grouped (not sailed in 1,492, though 10,400 BC).
This is more complicated, we'd have to admit, but I'd suggest clarity is necessary and if complexity is the cost of clarity, it's a cost we've got to pay.