tcl::mathfunc
tcl::mathfunc::NAME ?arg ...?
The functions of expr, each one also a command in this namespace. abs, ceil, floor, round, int, wide, entier, double, bool, sqrt, isqrt, exp, log, log10, pow, fmod, hypot, max, min, sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, rand, and srand. A proc in this namespace adds a function to expr.
This page also has tcl::mathfunc::abs, tcl::mathfunc::acos, tcl::mathfunc::asin, tcl::mathfunc::atan, tcl::mathfunc::atan2, tcl::mathfunc::bool, tcl::mathfunc::ceil, tcl::mathfunc::cos, tcl::mathfunc::cosh, tcl::mathfunc::double, tcl::mathfunc::entier, tcl::mathfunc::exp, tcl::mathfunc::floor, tcl::mathfunc::fmod, tcl::mathfunc::hypot, tcl::mathfunc::int, tcl::mathfunc::isqrt, tcl::mathfunc::log, tcl::mathfunc::log10, tcl::mathfunc::max, tcl::mathfunc::min, tcl::mathfunc::pow, tcl::mathfunc::rand, tcl::mathfunc::round, tcl::mathfunc::sin, tcl::mathfunc::sinh, tcl::mathfunc::sqrt, tcl::mathfunc::srand, tcl::mathfunc::tan, tcl::mathfunc::tanh, tcl::mathfunc::wide.
Examples
A click on an example runs it in the shell of the page.
expr {max(3, 9, 4)}:9expr {round(2.5)}:3expr {isqrt(17)}:4proc tcl::mathfunc::twice {x} {expr {$x * 2}}; expr {twice(21)}:42
Facts
- Capability: none.
- Compute cost: one compute unit for the call, and more for the commands that it runs.
Differences from Tcl 8.6
rand()has a fixed seed in a new interpreter, so that a script with no capability gives the same output each run.