Template:Rounddown
Appearance
This template rounds a numeric expression down to a given number of decimal places. Down in the sense that e.g. -2.5 is rounded to -3. Compare Template:Roundtozero.
- Usage:
{{Rounddown|expression}}
{{Rounddown|expression|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 down to a multiple of a power of ten.
- Examples:
{{Rounddown|3.14159|3}}
= 3.141{{Rounddown|-3.14159|3}}
= -3.142{{Rounddown|314159|-3}}
= 314000{{Rounddown|-314159|-3}}
= -315000{{Rounddown|+1/3}}
= 0{{Rounddown|2<1}}
= 0{{Rounddown|-1/3}}
= -1{{Rounddown|-2/3}}
= -1- For expressions containing equal signs use 1=expression - the second example fails:
{{Rounddown|1=3<=4}}
= 1{{Rounddown|3<=4}}
= Expression error: Unexpected < operator.
See also
[edit]- mw:Extension:ParserFunctions patch - ceil function