Template:Cents: Difference between revisions

Fredg999 (talk | contribs)
m Added See also section (to avoid confusion with a similar template)
ArrowHead294 (talk | contribs)
mNo edit summary
 
(31 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{<includeonly>subst:</includeonly>#number_format:{{<includeonly>subst:</includeonly>#expr: 1200*ln({{{1|{{{ratio|1}}}}}})/ln(2)}}|{{{2|{{{precision|0}}}}}}|.|}}<noinclude>
{{<includeonly>subst:</includeonly>#number_format: {{<includeonly>subst:</includeonly>#expr: 1200 * ln({{<includeonly>subst:</includeonly>#rmatch: {{{1|{{{ratio|1}}}}}}|^(.*?)[Cc]?$|\1}}) / ln(2)}}|{{{2|{{{prec|0}}}}}}|.|}}{{<includeonly>subst:</includeonly>#switch: {{<includeonly>subst:</includeonly>#rmatch: {{{1|{{{ratio|1}}}}}}|^.*?([Cc]?)$|\1}}|c={{c}}|C={{cent}}|#default=}}<noinclude>
{{documentation}}


This template calculates the cent value of its first argument (defaults to 1). An optional second argument controls the precision, it defaults to 0 decimal places.
[[Category:Functionality templates]]
 
It must always be combined with the ''subst:'' keyword. The substitution is already carried out for the page preview. At save, the cent value is being placed into the wiki source.
 
== Usage ==
Use this template like this
 
<nowiki>{{subst:cents|ratio|precision}}</nowiki>
 
== Example ==
 
this input in the wiki source
<nowiki>{{subst:cents|3|5}}</nowiki>
 
produces the following output
1901.95500
 
== See also ==
* [[Template:Cent]] — a template to insert the cent symbol
 
[[Category:Substituted templates]]
</noinclude>
</noinclude>