Version 4 of min

Updated 2007-11-01 15:05:19 by dgp

In Tcl 8.5, the expr command has a variadic min() function.

 % expr min(5,1,4,2,3)
 1

 % expr min(5,1.1,-17.345,1e10)
 -17.345

Like all math functions in Tcl 8.5, it is available as a command

 % namespace import ::tcl::mathfunc::min
 % min 5 1 4 2 3
 1

All arguments to the min must be able to be interpreted as numeric. Otherwise, you get this sort of error:

 % expr min("non-numeric")
 expected floating-point number but got "non-numeric"