[AMG]: TIP 232 [http://tip.tcl.tk/232] creates the '''::tcl::mathfunc''' [namespace] which contains commands implementing the [[[expr]]] math functions. The functions are documented in the '''mathfunc(n)''' man page [http://www.tcl.tk/man/tcl8.5/TclCmd/mathfunc.htm]. (Previous to TIP 232, the math functions were documented in '''expr(n)'''.) ---- '''List of functions:''' Absolute value abs arg | Hypotenuse length hypot x y Arc cosine acos arg | Coerce to word-sized integer int arg Arc sine asin arg | Natural logarithm log arg Arc tangent atan arg | Base-10 logarithm log10 arg Four-quadrant arc tangent atan2 y x | Greatest value max args Coerce to boolean bool arg | Least value min args Round up to whole number ceil arg | Power pow x y Cosine cos arg | Random in range (0,1) rand Hyberbolic cosine cosh arg | Round to whole number round arg Coerce to float double arg | Sine sin arg Coerce to integer entier arg | Hyperbolic sine sinh arg Exponential exp arg | Square root sqrt arg Round down to whole number floor arg | Seed random number generator srand arg Remainder fmod x y | Tangent tan arg Coerce to 64-bit integer wide arg | Hyperbolic tangent tanh arg ---- Thanks to TIP 232, you can create new functions without having to resort to '''Tcl_CreateMathFunc(3)''' [http://www.tcl.tk/man/tcl8.5/TclLib/CrtMathFnc.htm]. This makes it possible for pure Tcl scripts to extend [[[expr]]]. Also this makes it possible to rewrite or delete math functions, two things that were previously impossible even for extensions written in [C]. (I have written code that needed this functionality; I guess it's time to update it!) This makes math function arguments much more flexible, just as flexible as those of Tcl [proc]s and [command]s. One possibility worth noting is variadic numbers of arguments, a feature used by the shiny, new '''min()''' and '''max()''' functions. One more neat trick is calling math functions without using [[[expr]]]; they're regular Tcl commands now. Combine this with TIP 174 [Math Operators as Commands], and you can avoid using [[[expr]]] altogether, bypassing the problems discussed at [brace your expr-essions]. ---- [[ [Category Command] | [Category Syntax] ]]