Version 12 of acos

Updated 2007-10-31 18:56:15 by LV

acos (arc cosine) is one of the math commands available in expr, as well as in the tcl::mathfunc:: namespace as of Tcl 8.5.

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"

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

Category Command Category Mathematics Category Syntax