Template:Cents/doc: Difference between revisions

ArrowHead294 (talk | contribs)
No edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly><hr><small>Documentation transcluded from [[/doc]]</small></includeonly>
{{dochead}}{{substitute|always}}
== Usage ==
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.
 
=== Usage ===
Use this template like this
Use this template like this


<nowiki>{{subst:cents|ratio|precision}}</nowiki>
<pre>{{subst: cents|ratio|prec}}</pre>
 
=== Example ===
This input in the wiki source
<pre>{{subst: cents|3/2|5}}</pre>
 
produces the following output
: 701.95500
 
Intervals can even be typed as evaluable mathematical expressions. For example:
 
<pre>{{subst: cents|3^12/2^19|5}}</pre>
 
gives:
 
: 23.46001
 
Add in a lowercase C to the end of the expression to add {{tlx|c}}:
 
<pre>{{subst: cents|5/4c|2}}</pre>


== Example ==
gives:


this input in the wiki source
: 386.31{{c}}
<nowiki>{{subst:cents|3|5}}</nowiki>


produces the following output
Add in an uppercase C to add {{tlx|cent}}:
1901.95500
 
<pre>{{subst: cents|5/4C|2}}</pre>
 
gives:
 
: 386.31{{cent}}


== See also ==
=== See also ===
* [[Template:Cent]] — a template to insert the cent symbol
* [[Template:Cent]], [[Template:C]] – templates to insert the cent symbol, with and without (respectively) a link to [[cent|the article about cents]].
<noinclude>[[Category:Template documentation]]</noinclude>