@math:min
Minimum of two or more values.
On-chain (@math:min!): Operands are written out at the call site, or given as one literal array; an array a call returns has no on-chain form here.
Returns: number
Syntax
Section titled “Syntax”@math:min(...values)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
[...values] | any | Two or more numeric operands (or one array of them) |
Examples
Section titled “Examples”load math
set $vault 0x0102030405060708090a0b0c0d0e0f1011121314set $budget 500e18
# Variadic: folds left into nested calcUint(Min) callsassert @min!($vault::{a()(uint256)} $vault::{b()(uint256)} 100) <= 100
# Plain face: computed off-chain at script build time (plain helpers need the# module prefix; only the `!` faces resolve unqualified)set $floor @math:min(100e18 $budget)See Also
Section titled “See Also”On-chain face (@math:min!)
Section titled “On-chain face (@math:min!)”Folds the operands pairwise through min, so N operands cost N-1 reads.
The operands are collected at composition time — written out, or given as one
literal array. An array a CALL returns has no form here, unlike @sum!, which
folds a words payload. If you need the minimum of a live array, sort it and
take the first element: @at!(@sort!($v::caps()) 0).
- Signedness follows the operands: an
Intamong them picks the signed overload, so negative values order correctly.