Template:Signed number
Jump to navigation
Jump to search
Documentation The documentation below is transcluded from Template:Signed number/doc. (edit | history)
[purge]
See also: Template:Sign
This simple helper template adds a sign (plus + or minus −) to a number input. It applies {{formatnum:}} to the input in the process (which, for instance, also adds thousands separators), provided the input is a valid number.
Usage
{{ signed number | <number> | zero = plus/minus/plusminus }}
- First unnamed parameter
The input value. This should be a purely numerical value, otherwise the template may have unexpected results, since it treats the input as an expression.
- zero
By default, no sign is displayed if the input is 0. This parameter can be used to display either a plus sign, a minus sign, or a plus–minus sign if the input is 0. It has no effect if the input is not 0.
Examples
| Code | Result |
|---|---|
{{signed number|1}} |
+1 |
{{signed number|-1}} |
−1 |
{{signed number|0}} |
0 |
{{signed number|0|zero=plus}} |
+0 |
{{signed number|0|zero=minus}} |
−0 |
{{signed number|0|zero=plusminus}} |
±0 |
{{signed number|1|zero=minus}} |
+1 |
{{signed number|+1}} |
+1 |
{{signed number|one}} |
one |
{{signed number|1000234}} |
+1,000,234 |