min, mini, minf

Synopsis

min

set min(set)
set min(set, int)

mini

int mini(set)

minf

float  minf(set)

Description

The min command, in its first form returns a singleton set consisting of the smallest number in the parameter set. In the second form, the returned set is not a singleton, but contains X smallest numbers from the input set, where X is the second parameter.

This command only considers numeric members of the input set, or strings that can be interpreted as a number. All other members of the set are ignored. If the set contains no numbers and no strings that can be interpreted as a number, an empty set is returned.

The mini and minf commands operate in essentially the same way as min, except that they return an int or a float respectively. The smallest found number in the provided set is cast to the appropriate return type, and rounded if necessary.

Example

>> numbers= { 1,2,3,4,5,345,23451,24,1234,5616,1,3451,41,64,134,1,34,6134,7665,783}
>> strings = {"aaa", "bbb", "ccc", "ddd", "eee", "fff"}
>> floats ={231.234, 123.62341, 8456.2361, 4444444.111}
>> numStrings = {"2341.342", "11", "999999", "3e10"}

>> min (numbers)
1
>> min (floats, 3)
123.62341
231.234
8456.236
>> min (numStrings, 4)
11
2341.342
999999
3e10
>> {} == min (strings)
true
>> min (numbers+floats+strings+numStrings, 5)
1
2
3
4
5

See Also

max