User:Willscrlt/Rndnear

From Wikibooks, open books for an open world
Jump to: navigation, search
Documentation[edit] [history] [purge]

Test cases[edit]

Buggy rndnear:

  • [{{Rndnear|4.5678}}] → [4.50]
  • [{{Rndnear|2.3456}}] → [2.25]
  • [{{rndnear|1.2345}}] → [1.25]
  • [{{rndnear|{{{empty|}}}}}] → []
  • [{{rndnear|Text|10}}] → []

Modified rndnear that returns a blank (like {{isnumeric}}) instead of an error

  • [{{User:Willscrlt/Rndnear|4.5678}}] → [4.50]
  • [{{User:Willscrlt/Rndnear|2.3456}}] → [2.25]
  • [{{User:Willscrlt/Rndnear|1.2345}}] → [1.25]
  • [{{User:Willscrlt/Rndnear|{{{empty|}}}}}] → []
  • [{{User:Willscrlt/Rndnear|Text|10}}] → []

See also[edit]

Original documentation follows:


This template rounds to a multiple. It takes two parameters.

  1. the number to be rounded (any real number)
  2. the multiple to be rounded to
  • {{rndnear|0.1234|0.05}} → 0.10
  • {{rndnear|12.65|0.25}} → 12.75
  • {{rndnear|-9.123|1}} → −9
  • {{rndnear|-912|5}} → −910
  • {{rndnear|39123|10}} → 39,120
  • {{rndnear|Text|10}}

See also[edit]