Toggle menu
15
236
69
27.5K
Kenshi Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 00:36, 21 February 2025 by Prd (talk | contribs) (Created page with "{{documentation subpage}} This template rounds up a numeric value to a limited number of decimal places. ==Usage== * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|</nowiki></code>''value''<code><nowiki>}}</nowiki></code> * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|</nowiki></code>''value''<code><nowiki>|</nowiki></code>''decimals''<code><nowiki>}}</nowiki></code> * Both parameters can be any valid numeric expression; however, ''decimals'' should be an intege...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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; however, decimals should be an integer.
  • The decimals parameter defaults to 0.
  • decimals can be negative to round up to a multiple of a power of ten.
  • NAN may be returned if very large values are used.

Examples

Template Result Expected
{{Roundup|3.14159|3}} 3.142 3.142
{{Roundup|0|3}} 0 0
{{Roundup|-0.00031|3}} 0 0
{{Roundup|-3.14159|3}} -3.141 -3.141
{{Roundup|0|0}} 0 0
{{Roundup|-0.9|0}} 0 0
{{Roundup|314159|-3}} 315000 315000
{{Roundup|0|-3}} 0 0
{{Roundup|-514.15|-3}} 0 0
{{Roundup|-514159|-3}} -514000 -514000
{{Roundup|1}} 1 1

Note

  • You should use the parserfunction {{#expr:ceil value}} rather than {{Roundup|value}} or {{Roundup|value|0}}. This template should only be used to round up to a number of decimal places other than zero.

See also