Template:Round

From Meta, a Wikimedia project coordination wiki

This template rounds a number, producing corresponding trailing zeros:

  • {{round|1|2}} → 1.00
  • {{round|1.2|2}} → 1.20
  • {{round|1.23|2}} → 1.23
  • {{round|1.234|2}} → 1.23
  • {{round|-1|2}} → -1.00
  • {{round|-1.2|2}} → -1.20
  • {{round|-1.23|2}} → -1.23
  • {{round|-1.234|2}} → -1.23

Technical details[edit]

The method is based on the result of #expr and adds a point and zeros when needed.