Template:Cents/doc: Difference between revisions
Jump to navigation
Jump to search
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) m →Example |
||
Line 7: | Line 7: | ||
=== Example === | === Example === | ||
This input in the wiki source | This input in the wiki source | ||
: <code>{{((}}cents{{pipe}}3{{pipe}}5{{))}}</code> | : <code>{{((}}cents{{pipe}}3/2{{pipe}}5{{))}}</code> | ||
produces the following output | produces the following output | ||
: {{cents|3|5}} | : {{cents|3/2|5}} | ||
Intervals can even be typed as evaluable mathematical expressions. For example: | |||
: <code>{{((}}cents{{pipe}}3^12/2^19{{pipe}}5{{))}}</code> | |||
gives: | |||
: {{cents|3/2*(64/63)^(2/7)|5}} | |||
=== See also === | === See also === | ||
* [[Template:Cent]] – A template to insert the cent symbol | * [[Template:Cent]] – A template to insert the cent symbol |
Revision as of 18:53, 29 August 2024
Usage
Use this template like this
{{cents|ratio|precision}}
Example
This input in the wiki source
{{cents|3/2|5}}
produces the following output
- {{subst:#number_format: {{subst:#expr: 1200 * ln({{subst:#rmatch: 3/2|^(.*?)[Cc]?$|\1}}) / ln(2)}}|5|.|}}{{subst:#switch: {{subst:#rmatch: 3/2|^.*?([Cc]?)$|\1}}|c= ¢|C= ¢|#default=}}
Intervals can even be typed as evaluable mathematical expressions. For example:
{{cents|3^12/2^19|5}}
gives:
- {{subst:#number_format: {{subst:#expr: 1200 * ln({{subst:#rmatch: 3/2*(64/63)^(2/7)|^(.*?)[Cc]?$|\1}}) / ln(2)}}|5|.|}}{{subst:#switch: {{subst:#rmatch: 3/2*(64/63)^(2/7)|^.*?([Cc]?)$|\1}}|c= ¢|C= ¢|#default=}}
See also
- Template:Cent – A template to insert the cent symbol