「テンプレート:Formatnum/doc」の版間の差分
ナビゲーションに移動
検索に移動
細 (1版) |
(相違点なし)
|
2015年3月14日 (土) 12:15時点における最新版
モジュール:Message box/ombox.cssページに内容がありません。
This is a documentation subpage for テンプレート:Formatnum. It contains usage information, categories and other content that is not part of the original テンプレート page. |
This template formats a number in the local format (local numerals, local thousands separator, decimal separator and the pattern of separators) of a given language.
The total number of digits before and after the decimal point is limited to 16. In the 16th digit there may be a deviation of 1 or 2 units, as the unit in the last place (ulp) has a maximum of 2.22 units in the 16th digit (see also Help:Calculation#Accuracy).
Parameters
Parameter name | Description | Default value
|
---|---|---|
1 | number without thousands separators | empty |
2 | language code | value of {{int:Lang}} |
sep | set to any non-empty value to produce a result without thousands separators | empty |
prec | number of digits after the decimal point to show | if empty or undefined: 0 |
Examples
Some results depend on the user language, try: de • en • fr • nl
{{formatnum|1234567890.123}}
→ 1,234,567,890.123{{formatnum|1234567890.123|en}}
→ 1,234,567,890.123{{formatnum|1234567890.123|sep=x}}
→ 1234567890.123{{formatnum|1234567890.123|en|sep=x}}
→ 1234567890.123{{formatnum|1234567890.123|nl}}
→ 1.234.567.890,123{{formatnum|1234567890.123|de}}
→ 1.234.567.890,123{{formatnum|1234567890.123|fr}}
→ 1 234 567 890,123{{formatnum|1234567890.123|bn}}
→ ১,২৩,৪৫,৬৭,৮৯০.১২৩ (বাংলা){{formatnum|1234567890.123|hi}}
→ १,२३,४५,६७,८९०.१२३ (हिन्दी){{formatnum|1234567890.123|fa}}
→ ۱٬۲۳۴٬۵۶۷٬۸۹۰٫۱۲۳ (فارسی){{formatnum|1234567890.123|kn}}
→ ೧,೨೩,೪೫,೬೭,೮೯೦.೧೨೩ (ಕನ್ನಡ){{formatnum|1234567890.123|pa}}
→ 1,23,45,67,890.123 (ਪੰਜਾਬੀ)
{{formatnum|123456789012.12}}
→ 123,456,789,012.12{{formatnum|12345678901.12}}
→ 12,345,678,901.12{{formatnum|1234567890.12}}
→ 1,234,567,890.12{{formatnum|234567890.12}}
→ 234,567,890.12{{formatnum|34567890.12}}
→ 34,567,890.12{{formatnum|4567890.12}}
→ 4,567,890.12{{formatnum|567890.12}}
→ 567,890.12{{formatnum|67890.12}}
→ 67,890.12{{formatnum|7890.12}}
→ 7,890.12{{formatnum|890.12}}
→ 890.12{{formatnum|90.12}}
→ 90.12{{formatnum|4.12}}
→ 4.12{{formatnum|4.1}}
→ 4.1{{formatnum|4}}
→ 4
{{formatnum|1234567890.12345}}
→ 1,234,567,890.1235{{formatnum|1234567890.123456}}
→ 1,234,567,890.1235
{{formatnum|1234567890|prec=3}}
→ 1,234,567,890.000{{formatnum|1234567890.1|prec=3}}
→ 1,234,567,890.100{{formatnum|1234567890.12|prec=3}}
→ 1,234,567,890.120{{formatnum|1234567890.123|prec=3}}
→ 1,234,567,890.123{{formatnum|1234567890.1234|prec=3}}
→ 1,234,567,890.123{{formatnum|1234567890.12345|prec=3}}
→ 1,234,567,890.123{{formatnum|1234567890.123456|prec=3}}
→ 1,234,567,890.123
{{formatnum|0.000123456|prec=3}}
→ 0.000
{{formatnum|9999999999.9999}}
→ 9,999,999,999.9999{{formatnum|9999999999.99999}}
→ 10,000,000,000{{formatnum|9999999999.999999}}
→ 10,000,000,000{{formatnum|9999999999.9999999}}
→ 10,000,000,000
{{formatnum|-6.7e-8}}
→ −6.7E−8{{formatnum|0}}
→ 0{{formatnum|0|bn}}
→ ০{{formatnum|6.7e-18}}
→ 6.7E−18{{formatnum|6.7e-8}}
→ 6.7E−8{{formatnum|6.7e8}}
→ 670,000,000{{formatnum|1.234567890123456e17}}
→ 1.2345678901235E17{{formatnum|6.7e17}}
→ 6.7E17{{formatnum|1.234567890123456e18}}
→ 1.2345678901235E18{{formatnum|6.7e18}}
→ 6.7E18
{{formatnum|e8}}
→ e8 (not a valid number, returns the input){{formatnum}}
→
Required
Localization
This template does not have to be localized itself.
See also
- commons:Template:Formatnum
- w:Decimal separator#Examples of use
- Template:Nts - in addition to formatting the number, also an invisible sortkey is prefixed