SplitScript reference / Numeric
Numeric
capability
capability Numeric
Supports ordered numeric operations.
Numeric values provide minimum, maximum, clamping, ordered comparisons, and equality while preserving their inferred type. Integer arithmetic results wrap to the declared integer width.
Examples
Keep an integer below a limit
let cappedStage = 12.min(7)
Requires
| Member | Description | Available through |
|---|---|---|
| Equatable | Supports equality comparison. |
Implemented by
| Member | Description | Available through |
|---|---|---|
| address | Stores a process address. | |
| f32 | Stores a 32-bit floating-point number. | |
| f64 | Stores a 64-bit floating-point number. | |
| i16 | Stores a 16-bit signed integer. | |
| i32 | Stores a 32-bit signed integer. | |
| i64 | Stores a 64-bit signed integer. | |
| i8 | Stores an 8-bit signed integer. | |
| u16 | Stores a 16-bit unsigned integer. | |
| u32 | Stores a 32-bit unsigned integer. | |
| u64 | Stores a 64-bit unsigned integer. | |
| u8 | Stores an 8-bit unsigned integer. |
Operators
| Member | Description | Available through |
|---|---|---|
| + | Adds another value of the same numeric type. | |
| / | Divides by another value of the same numeric type. | |
| * | Multiplies by another value of the same numeric type. | |
| - | Subtracts another value of the same numeric type. |
Methods
| Member | Description | Available through |
|---|---|---|
| clamp | Restricts a numeric value to an inclusive range. | |
| max | Returns the larger of two numeric values. | |
| min | Returns the smaller of two numeric values. | |
| squared | Multiplies this value by itself. | |
| swapBytes | Reverses the order of the bytes in this numeric value. |