Template:Cents/doc: Difference between revisions
ArrowHead294 (talk | contribs) No edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
(17 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{dochead}} | {{dochead}}{{substitute|always}} | ||
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 === | === Usage === | ||
Use this template like this | Use this template like this | ||
<pre>{{subst: cents|ratio|prec}}</pre> | |||
=== Example === | === Example === | ||
This input in the wiki source | This input in the wiki source | ||
<pre>{{subst: cents|3/2|5}}</pre> | |||
produces the following output | 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> | |||
gives: | |||
: 386.31{{c}} | |||
Add in an uppercase C to add {{tlx|cent}}: | |||
<pre>{{subst: cents|5/4C|2}}</pre> | |||
gives: | |||
: 386.31{{cent}} | |||
=== See also === | === See also === | ||
* [[Template:Cent]] | * [[Template:Cent]], [[Template:C]] – templates to insert the cent symbol, with and without (respectively) a link to [[cent|the article about cents]]. |