Template:Round

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

This template rounds a number that is passed to it as the first parameter, with the number of decimal places to round to passed as the second parameter. If no second parameter is provided, it rounds to one decimal place to the left. If a whole number is provided to the template, it does nothing.

Usage

Syntax Result
{{round|1.2345}} 1.235
{{round|1.2345|2}} 1.23
{{round|1.2345|0}} 1
{{round|1.2|2}} 1.2
{{round|12.345}} 12.35
{{round|123.45}} 123.5
{{round|1234.5}} 1235
{{round|12345}} 12345
{{round|-1.2345}} -1.235
{{round|-1.2345|2}} -1.23
{{round|-1.2345|0}} -1
{{round|-12.345}} -12.35
{{round|-123.45}} -123.5
{{round|-1234.5}} -1235
{{round|-12345}} -12345

See also

Personal tools
Namespaces
Variants
Actions
Navigation
Community
Toolbox
Sister projects