Template:Round/doc
Template:Strong for Template:Terminate sentence It may contain usage information, categories and other content that is not part of the original template page. |
This templates rounds parameter 1 to the number of digits after the point optionally given as parameter 2. If parameter 2 is negative, rounding is to a multiple of 10. If parameter 2 is undefined, numbers with 4 digits before the point are rounded to integers, numbers with 3 digits before the point are rounded to 1 digit after the point, numbers with 2 digits before the point are rounded to 2 digits after the point, and numbers with 1 digit before the point or none are rounded to 3 digits after the point.
In other words, if parameter 2 is undefined, rounding is to 4 significant digits, except that it is not cruder than rounding to an integer and not finer than rounding to three digits after the decimal point.
Examples:
- Template:Xpdop3p3c
- Template:Xpdop3p3c
- Template:Xpdop3p3c
- Template:Xpdop3p3c
- Template:Xpdop3p3c
- Template:Xpdop3p3c
- Template:Xpdop3p3c
- Template:Xpdop3p3c
- Template:Xpdop3c
- Template:Xpdop3c
- Template:Xpdop3c
- Template:Xpdop3c
- Template:Xpdop3c
- Template:Xpdop3c
- Template:Xpdop3c
- Template:Xpdop3c
- Template:Xpdop3c
Note that trailing zeros are not shown, so rounding can seem cruder than has actually been applied:
While this is a limitation of the template (normally there would be trailing zeros to show the precision), there is also the general problem that if a number is an integer with trailing zeros, then the precision is not clear:
See also
badlo- {{roundup}}
- {{rounddown}}
- {{decimals}} – acts like rounding but displays trailing zeros after the decimal point
- {{precision}} – handles rounding of large numbers, too, like "349,030,293" → "349,030,000", "349,000,000", or "350,000,000"
TemplateData
badloTemplateData for Round
This templates rounds a value to the optionally given number of digits after the point.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Value | 1 | The value to be rounded
| Number | required |
Number of digits | 2 | Number of digits after the point. If negative, rounding is to a multiple of 10. If undefined, numbers with 4 digits before the point are rounded to integers, numbers with 3 digits before the point are rounded to 1 digit after the point, numbers with 2 digits before the point are rounded to 2 digits after the point, and numbers with 1 digit before the point or none are rounded to 3 digits after the point.
| Number | optional |