User:Trang Oul/Sandbox/Template:Range/Signed
< User:Trang Oul | Sandbox | Template:Range
Jump to navigation
Jump to search
Usage
{{Range/Signed|min|max}}
Description
This template formats a range using signed arithmetic. It handles three cases depending on whether the boundaries are positive, negative, or have different signs.
- **Both boundaries are non-negative:** Displays the difference as a positive expression.
- **Both boundaries are non-positive:** Displays the difference between their absolute values, with the larger absolute value first.
- **Mixed signs:** Displays the original boundaries as a subtraction, preserving their signs.
Examples
| Code | Result | Description |
|---|---|---|
{{Range/Signed|10|30}}
|
+(10-30) | Both boundaries are positive. |
{{Range/Signed|0|30}}
|
+(0-30) | Starts at zero. |
{{Range/Signed|-30|-10}}
|
-(10-30) | Both boundaries are negative; absolute values are ordered from smaller to larger. |
{{Range/Signed|-10|0}}
|
-(0-10) | Ends at zero. |
{{Range/Signed|-30|10}}
|
((-30)-(+10)) | Mixed signs. |