Difference between revisions of "Template:INRConvert/Wordify"

From blackwiki
Jump to navigation Jump to search
imported>Joshua Issac
imported>Joshua Issac
m (Missing expr.)
Line 9: Line 9:
 
</noinclude>{{#switch: {{{numsys|usa}}}
 
</noinclude>{{#switch: {{{numsys|usa}}}
 
| usa = {{#switch: {{Order of magnitude|{{{1|1}}}}}
 
| usa = {{#switch: {{Order of magnitude|{{{1|1}}}}}
| 12 = {{{1|1}}}/1E12 round {{{round|2}}}}} trillion
+
| 12 = {{#expr: {{{1|1}}}/1E12 round {{{round|2}}}}} trillion
|  9 = {{{1|1}}}/1E9 round {{{round|2}}}}} billion
+
|  9 = {{#expr: {{{1|1}}}/1E9 round {{{round|2}}}}} billion
|  6 = {{{1|1}}}/1E6 round {{{round|2}}}}} million
+
|  6 = {{#expr: {{{1|1}}}/1E6 round {{{round|2}}}}} million
 
|  #default = {{#ifexpr: {{{1|1}}}/1E12 >= 1
 
|  #default = {{#ifexpr: {{{1|1}}}/1E12 >= 1
 
| {{#expr: {{{1|1}}}/1E12 round {{{round|2}}}}} trillion<!-- greater than a trillion -->
 
| {{#expr: {{{1|1}}}/1E12 round {{{round|2}}}}} trillion<!-- greater than a trillion -->
Line 17: Line 17:
 
}}
 
}}
 
| ind = {{#switch: {{Order of magnitude|{{{1|1}}}}}
 
| ind = {{#switch: {{Order of magnitude|{{{1|1}}}}}
| 12 = {{{1|1}}}/1E12 round {{{round|2}}}}} lakh crore
+
| 12 = {{#expr: {{{1|1}}}/1E12 round {{{round|2}}}}} lakh crore
|  7 = {{{1|1}}}/1E7 round {{{round|2}}}}} crore
+
|  7 = {{#expr: {{{1|1}}}/1E7 round {{{round|2}}}}} crore
|  5 = {{{1|1}}}/1E5 round {{{round|2}}}}} lakh
+
|  5 = {{#expr: {{{1|1}}}/1E5 round {{{round|2}}}}} lakh
 
|  #default = {{#ifexpr: {{{1|1}}}/1E12 >= 1
 
|  #default = {{#ifexpr: {{{1|1}}}/1E12 >= 1
 
| {{#expr: {{{1|1}}}/1E12 round {{{round|2}}}}} lakh crore<!-- greater than a lakh crore -->
 
| {{#expr: {{{1|1}}}/1E12 round {{{round|2}}}}} lakh crore<!-- greater than a lakh crore -->

Revision as of 22:04, 10 November 2019

This subtemplate will accept a number and output a formatted string with a smaller number and the divisor as a word in a number scaling system. For example, an input of 1010000 (with the short scale system and rounding to two decimal places) will result in an output of "1.01 billion".

This template will factorise out trillion, billion and million from the given number for the short scale system. Use the round parameter to round the resulting number (e.g. round=3 will yield 1.010 billion). Use the numsys parameter to choose the numbering system; currently, the supported arguments are usa for the short scale and ind for the Indian numbering system.

Template:INRConvert/inflation/b does something similar to this template.

{{#switch: usa | usa = {{#switch: Template:Order of magnitude | 12 = 0 trillion | 9 = 0 billion | 6 = 0 million | #default = 1 | ind = number system not supported