Template:Cents: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
Xenwolf (talk | contribs)
interims solution
Xenwolf (talk | contribs)
ready
Line 1: Line 1:
<!-- {{#number_format:{{#expr: 1200*ln({{{1|{{{ratio|1}}}}}})/ln(2)}}|{{{2|{{{precision|0}}}}}}|.|}}<noinclude>
<!-- {{#number_format:{{#expr: 1200*ln({{{1|{{{ratio|1}}}}}})/ln(2)}}|{{{2|{{{precision|0}}}}}}|.|}}<noinclude>
This template calculates the cent value of its argument (defaults to 1). An optional second parameter controls the precision, it defaults to 0 decimal places.
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.


<big>It requires the MediaWiki [https://www.mediawiki.org/wiki/Extension:NumberFormat Extension:NumberFormat] being [[Special:Version|installed]].</big>
<big>It requires the MediaWiki [https://www.mediawiki.org/wiki/Extension:NumberFormat Extension:NumberFormat] being [[Special:Version|installed]].</big>
Line 7: Line 7:
</noinclude>
</noinclude>
-->{{#expr: 1200*ln({{{1|{{{ratio|1}}}}}})/ln(2) round {{{precision|{{{2|0}}}}}}}}<noinclude>
-->{{#expr: 1200*ln({{{1|{{{ratio|1}}}}}})/ln(2) round {{{precision|{{{2|0}}}}}}}}<noinclude>
This template calculates the cent value of its argument (defaults to 1). An optional second parameter controls the precision, it defaults to 0 decimal places.
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.


<big>'''This is a temporary solution.'''</big>
<big>'''This is a temporary solution.'''</big>


It doesn't care for dangling zeros.
It doesn't care for dangling zeros, exactly following [http://php.net/manual/en/function.round.php PHP's round function].


[[Category:Templates]]
[[Category:Templates]]
</noinclude>
</noinclude>

Revision as of 15:02, 29 October 2018

0 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.

This is a temporary solution.

It doesn't care for dangling zeros, exactly following PHP's round function.