Template:Plusminus%
Jump to navigation
Jump to search
Formats number as a ±percentage (“+#.#%”, “— ”, or “−#.#%”) formatting to the specified number of decimal places.
Usage
{{ Plusminus% | number | decimals }} (a.k.a. {{ ±% | number | decimals }})
where:
Parameter | Description | Default | |
---|---|---|---|
1 | number | is a ±number between than 1.0 and −1.0 (for percentages between +100% and −100%) | 0 |
2 | decimals | is the number of decimals to be displayed in the rounded, formatted percentage figure (i.e. decimals =1 → 100.0%) | 1 |
Examples
Code | yields |
---|---|
{{±% | 0.1234567 | 2 }} | +12.35% |
{{±% | -0.1234567 | 4 }} | −12.3457% |
{{Plusminus% | 0 | 4 }} | — |
{{Plusminus% | 0 | 2 }} | — |
{{Plusminus% | 0 | 0 }} | — |
{{±% | 0.1 | 0 }} | +10% |
{{±% | 0 }} | — |
{{±% | 0.54321 }} | +54.3% |
{{±%}} | +0.0% |
{{±% | 0.567 | -1 }} | +50% |