beetlebug▾
/

tcl::mathfunc cbrtTcl 9.1 only

Gives the cube root of a number.

tcl::mathfunc::cbrt NUMBER
expr {cbrt(NUMBER)}

Description

Gives the real cube root of NUMBER. A negative number has a negative cube root.

Arguments

ArgumentTypeDefaultDescription
NUMBERnumberrequiredAny number.

Returns

A float.

Examples

% expr {cbrt(27)}
3.0

% expr {cbrt(-8)}
-2.0

% expr {cbrt(2)}
1.2599210498948732

Errors

% expr {cbrt("x")}
expected floating-point number but got "x"
-errorcode TCL VALUE NUMBER

% expr {cbrt(NaN)}
floating point value is Not a Number
-errorcode TCL VALUE DOUBLE NAN

Differences from Tcl

Facts

Capability
None.
Tcl release
Tcl 9.1 only.
Since
ztcl 1.0.0-beta.1

See also