More actions
mNo edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{zero|{{expr:{{ifexpr: {{abs|{{{1}}}}}-({{abs|{{{1}}}}} round {{{2|0}}})<=0|({{{1}}}) round {{{2|0}}}|(({{{1}}}) round {{{2|0}}}) + ({{{1}}})/{{abs|{{{1}}}}}/{{pow|10|{{{2|0}}}}}}}}}}}</includeonly><noinclude> | <includeonly>{{zero|{{#expr:{{#ifexpr:{{abs|{{{1}}}}}-({{abs|{{{1}}}}} round {{{2|0}}})<=0|({{{1}}}) round {{{2|0}}}|(({{{1}}}) round {{{2|0}}}) + ({{{1}}})/{{abs|{{{1}}}}}/{{pow|10|{{{2|0}}}}}}}}}}}</includeonly><noinclude>This template rounds up a numeric value to a limited number of decimal places. | ||
; Usage | |||
* {{tlp|{{PAGENAME}}|''value''}} | |||
; Usage | * {{tlp|{{PAGENAME}}|''value''|''decimals''}} | ||
* | |||
* | |||
* Both parameters can be any valid numeric expression. | * Both parameters can be any valid numeric expression. | ||
* The ''decimals'' parameter defaults to 0 and is rounded to the nearest integer. | * The ''decimals'' parameter defaults to 0 and is rounded to the nearest integer. | ||
* ''decimals'' can be negative to round up to a multiple of a power of ten. | * ''decimals'' can be negative to round up to a multiple of a power of ten. | ||
* If ''decimals'' is not between -20 and 20, the ''value'' is returned without rounding. | * If ''decimals'' is not between -20 and 20, the ''value'' is returned without rounding. | ||
[[Category:Mathematical templates|{{PAGENAME}}]] | [[Category:Mathematical templates|{{PAGENAME}}]] | ||
[[Category:Templates using ParserFunctions|{{PAGENAME}}]] | [[Category:Templates using ParserFunctions|{{PAGENAME}}]] | ||
</noinclude> | </noinclude> |
Latest revision as of 16:00, 2 August 2006
This template rounds up a numeric value to a limited number of decimal places.
- Usage
- {{Roundup|value}}
- {{Roundup|value|decimals}}
- Both parameters can be any valid numeric expression.
- The decimals parameter defaults to 0 and is rounded to the nearest integer.
- decimals can be negative to round up to a multiple of a power of ten.
- If decimals is not between -20 and 20, the value is returned without rounding.