This site is supported by donations to The OEIS Foundation.
Help:Number formatting
Adapted from: Help:Magic words#Formatting—MediaWiki.org.
Formatting a number
To get the number's decimal representation with decimal group separators, and localized digit script, according to the wiki's default locale.
- {{formatnum: unformatted number}}
Note: You should use a proper − (−) sign, instead of an - (hyphen).
For example
- {{formatnum: -987654321.654321}}
gives
- -987,654,321.654321
while
- {{formatnum: −987654321.654321}}
gives
- −987,654,321.654321
Warning: Leading zeros are not removed (use {{#expr: unformatted number}} to remove them).
For example
- {{formatnum: 00001}}
gives
- 00,001
while
- {{formatnum: {{#expr: 00001}} }}
gives
- 1
Unformatting a number
The |R parameter can be used to unformat (Remove formatting) a number, for use in mathematical situations. The number has to be given with decimal and decimal group separators, and localized digit script, according to the wiki's default locale.
- {{formatnum: formatted number|R}}
Note: For a formatted number, you should use a proper − (−) sign, instead of an - (hyphen), although mathematical expressions, e.g. the #expr: parser function, will unfortunately turn it into an hyphen.
For example
- {{formatnum: -987,654,321.654321|R}}
gives
- -987654321.654321
and
- {{#expr: {{formatnum: -987,654,321.654321|R}} }}
gives
- -987654321.65432
while
- {{formatnum: −987,654,321.654321|R}}
gives
- −987654321.654321
and
- {{#expr: {{formatnum: −987,654,321.654321|R}} }}
gives
- -987654321.65432
Warning: Leading zeros are not removed (use {{#expr: unformatted number}} to remove them).
For example
- {{formatnum: 00,001|R}}
gives
- 00001
while
- {{#expr: {{formatnum: 00,001|R}} }}
gives
- 1