Template:Rnd: Difference between revisions

includes trailing zeros except in the range where E notation is used.
m>Patrick
(example)
m>Patrick
(includes trailing zeros except in the range where E notation is used.)
Line 1: Line 1:
<includeonly>{{rnd/+|{{{1}}}|{{{2}}}|{{rnd/0{{#expr:{{{2}}}>0}}|{{{1}}}|{{{2}}}}}}}</includeonly><noinclude>{{pp-template}}This template rounds {{{1}}} to {{{2}}} decimal places (goes the other way for negatives), includes trailing zeros & avoids E notation.
<includeonly>{{rnd/+|{{{1}}}|{{{2}}}|{{rnd/0{{#expr:{{{2}}}>0}}|{{{1}}}|{{{2}}}}}}}</includeonly><noinclude>{{pp-template}}This template rounds {{{1}}} to {{{2}}} decimal places (goes the other way for negatives), includes trailing zeros except in the range where E notation is used.


Compare:
Compare:
*{{xpd|#expr:2.0004 round 3}}
*{{xpd|#expr:2.0004 round 3}}
*{{xpd|rnd|2.0004|3}}
*{{xpd|rnd|2.0004|3}}
*{{xpd|#expr:0.000020004 round 8}}
</noinclude>
</noinclude>
Anonymous user