Updated 2015-01-24 15:44:01 by dkf

acos (arc cosine, i.e., inverse of cosine) is one of the math commands available in expr, as well as in the tcl::mathfunc:: namespace as of Tcl 8.5.
expr { acos(expression) }
tcl::mathfunc::acos numericValue

It is a procedure which provides command access to the expr math function, taking the same arguments as the expr function and taking expressions as arguments as well.

LV 2007 Oct 31

Is the following one of the differences between using acos in expr and as a command? The above comment says "taking the same arguments as the expr function and taking expressions as arguments as well" - is there something special needed for the expressions to the procedure?
$ tclsh8.5
% expr {acos(4-5)}
3.141592653589793
% tcl::mathfunc::acos {4-5}
expected floating-point number but got "4-5"

DKF: That's just the difference between expressions and commands.

One good use for acos is to get the constant Pi:
% expr acos(-1)
3.141592653589793
% tcl::mathfunc::acos -1    ;# In Tcl 8.5
3.141592653589793