• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.154
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Roundup

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here
Template documentation[view] [edit] [history] [purge]

This template rounds up a numeric value to a limited number of decimal places.

Contents

  • 1 Usage
  • 2 Examples
  • 3 Note
  • 4 See also

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

  • Template:Ceil
  • Template:Rounddown
  • Template:Round

nl:Sjabloon:RoundUp

The above documentation is transcluded from Template:Roundup/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Roundup&oldid=29238"
Category:
  • Mathematical function templates
Last edited on 18 December 2017, at 23:37

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 18 December 2017, at 23:37.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop