User:Trang Oul/Sandbox/Template:Range/Signed
< User:Trang Oul | Sandbox | Template:Range
Jump to navigation
Jump to search
Usage
{{Range/Signed|min|max}}
Parameters
| Parameter | Description | Default |
|---|---|---|
1 (min)
|
The lower bound of the range. | |
2 (max)
|
The upper bound of the range. |
Behavior
This template formats a range using the two bounds min and max. It expects min to be less than or equal to max.
- Non-negative range (
min≥ 0): Encloses the range in parentheses and prefixes it with a leading+sign. Both boundaries retain their original parameter order. - Non-positive range (
max≤ 0): Displays the absolute values of both boundaries in reverse parameter order (maxbeforemin), enclosing the range in parentheses and prefixing it with a leading-sign. - Mixed-sign range (otherwise): Encloses the range and each boundary in parentheses, preserving the original parameter order and marking the positive maximum with a leading
+sign.
Examples
| Input | Result | Description |
|---|---|---|
{{Range/Signed|10|30}}
|
+(10-30) | Both boundaries are positive. |
{{Range/Signed|0|30}}
|
+(0-30) | Minimum is zero and maximum is positive. |
{{Range/Signed|-30|10}}
|
((-30)-(+10)) | Minimum is negative and maximum is positive. |
{{Range/Signed|-30|0}}
|
-(0-30) | Minimum is negative and maximum is zero. |
{{Range/Signed|-30|-10}}
|
-(10-30) | Both boundaries are negative. |