Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Decimal separator
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Digit grouping== <!-- Courtesy note per [[WP:RSECT]]: Several redirects link here. (Generally those with "separator" or "thousands" in their titles.) Please check with What Links here before renaming, leaving a hidden [[template:anchor]] to avoid breaking incoming links. See also [[:Talk:Decimal separator#Digit grouping and decimal separating aren't the same]]. --> For ease of reading, numbers with many digits (e.g. numbers over 999) may be divided into groups using a [[delimiter]],<ref name="AMA10p793">{{cite book |last=Iverson |first=Cheryl |display-authors=etal |year=2007 |title=AMA Manual of Style |edition=10th |publisher=[[Oxford University Press]] |location=Oxford, UK |isbn=978-0-19-517633-9 |page=793 |url=https://archive.org/details/amamanualofstyle0000unse/page/793 }}</ref> such as comma ({{code|,}}), dot ({{code|.}}), half-space or [[thin space]] ({{nobr|" "}}), [[Space (punctuation)|space]] ({{nobr|" "}}), underscore ({{code|_}}; as in maritime "21_450"),{{cn|date=April 2025}} or apostrophe ({{code|'}})<!-- f.e. in Switzerland -->. In some countries, these "digit group separators" are only employed to the left of the decimal separator; in others, they are also used to separate numbers with a long [[fractional part]]. An important reason for grouping is that it allows rapid judgement of the number of digits, via telling at a glance ("[[subitizing]]") rather than counting (contrast, for example, {{nobr|100 000 000}} with 100000000 for one hundred million). The use of thin spaces as separators<ref name="SIBrochure">{{SIbrochure8th}}</ref>{{rp|page=133}} instead of dots or commas (for example: {{nobr|20 000}} and {{nobr|1 000 000}} for "twenty thousand" and "one million"), has been official policy of the [[International Bureau of Weights and Measures]] (BIPM) since 1948 (and reaffirmed in 2003), <ref name=CGPM-22nd-R10/> as well as of the [[International Union of Pure and Applied Chemistry]] (IUPAC),<ref name="BIPM">{{cite report |publisher=[[International Bureau of Weights and Measures]] |title=Rules and style conventions for expressing values of quantities |url=https://www.nist.gov/pml/special-publication-811/nist-guide-si-chapter-10-more-printing-and-using-symbols-and-numbers}}</ref><ref name="old.iupac.org">{{cite report |title=Guidelines for drafting IUPAC technical reports and recommendations |year=2007 |url=http://old.iupac.org/reports/provisional/guidelines.html |access-date=2008-11-27}}</ref> the [[American Medical Association]]'s widely followed ''[[AMA Manual of Style]]'', and the UK [[Metrication Board]], among others. The groups created by the delimiters tend to follow the usages of local languages, which vary. In European languages, large numbers are read in groups of thousands, and the delimiter (occurring every three digits when used) may be called a "thousands separator". In [[East Asian culture]]s, particularly [[Chinese numerals|China]], [[Japanese numerals|Japan]], and [[Korean numerals|Korea]], large numbers are read in groups of [[myriad]]s ({{nobr|10 000s}}), but the delimiter often separates the digits into groups of three.{{citation needed|date=February 2014}}<!-- see talk page --> The [[Indian numbering system]] is more complex: It groups the rightmost three digits together (until the hundreds place) and then groups digits in sets of two. For example, one trillion would be written "10,00,00,00,00,000" or "{{nobr|10 [[Indian numbering system|{{translit|hi|kharab}}]]}}".<ref>{{cite report |last=Emmons |first=John |date=2018-03-25 |section=Part 3: Numbers |title=Unicode Locale Data Markup Language (LDML) |website=Unicode.org |section-url=https://www.unicode.org/reports/tr35/tr35-numbers.html#Special_Pattern_Characters |url-status=live |access-date=2018-03-25 |archive-url=https://web.archive.org/web/20180725183458/https://www.unicode.org/reports/tr35/tr35-numbers.html#Special_Pattern_Characters |archive-date=2018-07-25}}</ref> The convention for digit group separators historically varied among countries, but usually sought to distinguish the delimiter from the decimal separator. Traditionally, [[English-speaking countries]] (except South Africa)<ref>{{Cite web |url=https://extranet.education.unimelb.edu.au/SME/TNMY/Decimals/Decimals/backinfo/overseas.htm |title=Language and Culture Differences. |website=extranet.education.unimelb.edu.au |accessdate=11 March 2023}}</ref> employed commas as the delimiter β 10,000 β and other European countries employed periods or spaces: 10.000 or {{nobr|10 000}}. Because of the confusion that could result in international documents, in recent years, the use of spaces as separators has been advocated by the superseded [[ISO 31-0#Numbers|SI/ISO 31-0 standard]],<ref name="nist.gov">{{cite web |title=Decimals Score a Point on International Standards |date=2006-11-22 |publisher=U.S. [[National Institute of Standards and Technology]] |url=https://www.nist.gov/public_affairs/techbeat/tb2006_1122.htm#decimal |url-status=dead |access-date=2008-11-27 |archive-url=https://web.archive.org/web/20160303171543/https://www.nist.gov/public_affairs/techbeat/tb2006_1122.htm#decimal |archive-date=2016-03-03 }}</ref> as well as by the BIPM and IUPAC. These groups have also begun advocating the use of a "thin space" in "groups of three".<ref name="BIPM"/><ref name="old.iupac.org"/> Within the United States, the American Medical Association's widely followed ''AMA Manual of Style'' also calls for a thin space.<ref name="AMA10p793"/> In programming languages and online [[character encoding|encoding]] environments (for example, [[ASCII]]-only languages and environments) a thin space is not practical or available. Often, either underscores<ref>{{cite web|url=https://peps.python.org/pep-0515/#prior-art|title=PEP 515 Underscores in Numeric Literals: Prior Art|website=peps.python.org|accessdate=2024-02-13}}</ref> and regular word spaces, or no delimiters at all are used instead. ===Data vis-Γ -vis mask=== Digit group separators can occur either as part of the data or as a mask through which the data is displayed. This is an example of the [[separation of presentation and content]], making it possible to display numbers in spaced groups while not inserting any [[whitespace character]]s into the string of digits that make up those numbers. In many computing contexts, it is preferred to omit the digit group separators from the data and instead overlay them as a mask (an [[input mask]] or an output mask). Common examples include [[spreadsheet]]s and [[database]]s, in which currency values are entered without such marks but are displayed with them inserted. Similarly, phone numbers can have hyphens, spaces or parentheses as a mask rather than as data. In [[web content]], digit grouping can be done with [[CSS]]. This is useful because the number can be copied and pasted elsewhere (such as into a calculator) and parsed by the computer as-is (i.e., without the user manually purging the extraneous characters). For example: {{block indent |left=1.5 |text={{plainlist}} * {{val|149597870700}} metres is 1 [[astronomical unit]]. * {{gaps|3.14159|26535|89793|23846}} is [[pi|{{pi}}]] rounded to 20 decimal places. * {{gaps|2.71828|18284|59045|23536}} is {{mvar|[[E (mathematical constant)|e]]}} rounded to 20 decimal places. {{endplainlist}}}} In some [[programming language]]s, it is possible to group the digits in the program's [[source code]] to make it easier to read {{xref|(see: {{slink|Integer literal#Digit separators}})}}. Examples include: [[Ada programming language|Ada]], [[C Sharp (programming language)|C#]] (since {{nobr|version 7.0}}),<ref>{{cite report |title=New Features in C# 77.0 |section=Literal improvements |date=9 March 2017 |publisher=Microsoft |type=blog |section-url=https://devblogs.microsoft.com/dotnet/new-features-in-c-7-0/#literal-improvements |access-date=5 May 2022}}</ref> [[D (programming language)|D]], [[Go (programming language)|Go]] (since {{nobr|version 1.13}}), [[Haskell (programming language)|Haskell]] (from GHC {{nobr|version 8.6.1}}), [[Java (programming language)|Java]], [[JavaScript]] (since [[ECMAScript version history#12th Edition β ECMAScript 2021|ES2021]]), [[Kotlin (programming language)|Kotlin]],<ref>{{cite web |title=Basic types |website=Kotlin Language |url=https://kotlinlang.org/docs/basic-types.html#literal-constants:~:text=You%20can%20use%20underscores%20to%20make%20number%20constants%20more%20readable}}</ref> [[OCaml]], [[Perl]], [[Python (programming language)|Python]] (since {{nobr|version 3.6}}), [[PHP]] (since {{nobr|version 7.4}}),<ref>{{cite web |series=PHP: New Features |title=Numeric literal separator |publisher=The PHP Group |url=https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.numeric-literal-separator |access-date=2020-07-16}}</ref> [[Ruby (programming language)|Ruby]], [[Rust (programming language)|Rust]] and [[Zig (programming language)|Zig]]. Java, JavaScript, [[Swift (programming language)|Swift]], [[Julia (programming language)|Julia]] and free-form [[Fortran 90]] use the [[underscore]] ({{code|_}}) character for this purpose. As such, these languages would allow the number seven hundred million to be entered as "700_000_000". On the other hand, fixed-form Fortran ignores whitespace in all contexts, so "{{nobr|700 000 000}}" would be allowed. In [[C++14]], [[Rebol]] and [[Red (programming language)|Red]], the use of an [[apostrophe]] for digit grouping is allowed. Thus, "700'000'000" would be allowed in those languages. The code shown below, written in Kotlin, illustrates the use of separators to increase readability: <syntaxhighlight lang="kotlin" line="1"> val exampleNumber = 12_000_000 // twelve million </syntaxhighlight> ===Exceptions to digit grouping=== The International Bureau of Weights and Measures states that "when there are only four digits before or after the decimal marker, it is customary not to use a space to isolate a single digit."<ref name=BIPM/> Likewise, some [[Style guide|manuals of style]] state that thousands separators should not be used in normal text for numbers from {{val|1000}} to {{val|9999}} where no decimal fractional part is shown (or, in other words, for four-digit whole numbers), whereas others use thousands separators and others use both. For example, [[APA style]] stipulates a thousands separator for "most figures of {{val|1000}} or more" except for page numbers, binary digits, temperatures, etc. There are always "common-sense" country-specific exceptions to digit grouping, such as year numbers, [[postal code]]s, and ID numbers of predefined nongrouped format, which style guides usually point out. ===In non-base-10 numbering systems=== In binary (base-2), a full space can be used between groups of four digits, corresponding to a [[nibble]], or equivalently to a [[hexadecimal]] digit. For integer numbers, dots are used as well to separate groups of four bits.{{efn|name="DR-DEBUG_H"| As an example, the [[DR-DOS]] [[DEBUG (DOS command)|DEBUG]] {{code|H}} command (short for 'hex') displays the entered hexadecimal number in hexadecimal, followed by the same number in decimal, octal, and binary, prefixed with a hash sign ({{code|#}}), backslash ({{code|\}}), and percent sign ({{code|%}}) respectively: <pre> -h 1234 1234 #4660 \011064 %0001.0010.0011.0100 </pre>}} Alternatively, binary digits may be grouped by threes, corresponding to an [[octal]] digit. Similarly, in hexadecimal (base-16), full spaces are usually used to group digits into twos, making each group correspond to a [[byte]].{{efn|name="DR-DEBUG_D"}} Additionally, groups of eight bytes are often separated by a hyphen.{{efn|name="DR-DEBUG_D"| As an example, the [[DR-DOS]] [[DEBUG (DOS command)|DEBUG]] {{code|D}} command (short for 'dump') dumps the memory byte-wise in hexadecimal notation, with bytes separated by spaces and groups of eight bytes separated by hyphens: <syntaxhighlight lang="hexdump"> -d 0 1234:0000 57 69 6B 69 70 65 64 69-61 20 68 65 6C 70 73 21 Wikipedia helps! </syntaxhighlight>}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)