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

MemberDescriptionAvailable through
EquatableSupports equality comparison.

Implemented by

MemberDescriptionAvailable through
addressStores a process address.
f32Stores a 32-bit floating-point number.
f64Stores a 64-bit floating-point number.
i16Stores a 16-bit signed integer.
i32Stores a 32-bit signed integer.
i64Stores a 64-bit signed integer.
i8Stores an 8-bit signed integer.
u16Stores a 16-bit unsigned integer.
u32Stores a 32-bit unsigned integer.
u64Stores a 64-bit unsigned integer.
u8Stores an 8-bit unsigned integer.

Operators

MemberDescriptionAvailable 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

MemberDescriptionAvailable through
clampRestricts a numeric value to an inclusive range.
maxReturns the larger of two numeric values.
minReturns the smaller of two numeric values.
squaredMultiplies this value by itself.
swapBytesReverses the order of the bytes in this numeric value.