Loading

MIN

math

Returns the smaller of two numeric values.

The MIN function consumes two numeric parameters from the top of the stack and pushes back the smallest value.

Since 2.6.0, this function can be applied to a LIST of numerical values and a numerical value. The order of the parameter is very important in that case: considering this function as F, the result of [ $a $b $c ] F is $a $b F $c F ] but the result of [ $a $b ] $c F is [ $a $c F $b $c F ].

Since 2.7.1, this function can be applied to a GTS of numerical values. This is very similar to how this function works on LISTs, considering the values of the GTS. In that case, the order of the parameters also matters and the result is either a GTS or a single numerical value.

MIN is available since version 1.0.0.

See also

Signatures

Examples

1000 2000 MIN 3.14 42.5 MIN 1000 11.1 MIN 11.1 1000 MIN NaN 1000 MIN 0 NaN MIN
[ 1000 2000 3000 ] MIN [ 3.14 42.5 ] 10.4 MIN
NEWGTS 1 NaN NaN NaN 2 ADDVALUE 2 NaN NaN NaN 20 ADDVALUE 3 NaN NaN NaN 21 ADDVALUE 4 NaN NaN NaN 12 ADDVALUE 5 NaN NaN NaN 42 ADDVALUE 6 NaN NaN NaN 7 ADDVALUE 'gts' STORE $gts MIN $gts 8 MIN

Examples

return MIN(1000, 2000), MIN(3.14, 42.5), MIN(1000, 11.1), MIN(11.1, 1000), MIN(NaN, 1000), MIN(0, NaN)
return MIN([1000, 2000, 3000]), MIN([3.14, 42.5], 10.4)
gts = NEWGTS() ADDVALUE(gts, 1, NaN, NaN, NaN, 2) ADDVALUE(gts, 2, NaN, NaN, NaN, 20) ADDVALUE(gts, 3, NaN, NaN, NaN, 21) ADDVALUE(gts, 4, NaN, NaN, NaN, 12) ADDVALUE(gts, 5, NaN, NaN, NaN, 42) ADDVALUE(gts, 6, NaN, NaN, NaN, 7) return MIN(gts), MIN(gts, 8)