Template:Spellnum per MOS
From HandWiki
Revision as of 12:29, 2 January 2022 by imported>MainEditor (Created page with "<includeonly>{{#invoke:Spellnum per MOS|main|{{{1|}}}|forcenum={{{forcenum|}}}|zero={{{zero|}}}|adj={{{adj|}}}|ord={{{ord|}}}|us={{{us|}}}}}</includeonly><noinclude>{{doc}}</n...")
![]() | This template uses Lua: |
![]() | This template should be substituted unless the argument is dynamic (i.e., generated by another template or module that cannot be substituted). |
Converts numerals to words if appropriate per the style guide MOS:NUMERAL. The first unnamed parameter is the numeral to be evaluated. All optional parameters of {{number to word}} are accepted by this template.
Editors using this template are responsible for checking its output against the detailed guidance of MOS:NUMERAL.
Behavior
- Non-integers and values less than zero are given in numerals (e.g. 0.5, -3).
- Integers from zero to nine are spelled out in words (e.g. five).
- For integers greater than or equal to ten:
- By default, numbers expressible in one or two words are spelled out (e.g. fifty-six), and numbers requiring three or more words are given as numerals (e.g. 310).
- If the argument "forcenum" is given with a value of "true" (or equivalent per Template:Yesno), integers greater than or equal to ten are always expressed as a numeral.
- Numbers greater than one million are rounded to at most two significant figures
Examples
Case | Input | Default output | Output with forcenum = "true" or equivalent |
---|---|---|---|
negative or non-integer | -3 | −3 | −3 |
1.5 | 1.5 | 1.5 | |
integer less than 10 | 9 | 0 | 0 |
integer requiring two or fewer words | 54 | 0 | 54 |
8000 | 0 | 8,000 | |
integer requiring more than two words | 320 | 0 | 320 |
integers greater than one million | 12000000 | 0 | 12,000,000 |
12060000 | 0 | 12,060,000 | |
35000000 | 0 | 35,000,000 |
See also
- {{Number to word}} – called by this template; converts all numerals to words without regard for WP:NUMERAL