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
| Argument | Type | Default | Description |
|---|---|---|---|
| NUMBER | number | required | Any 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
- tclsh 9.1.0 gives 3.0000000000000004 for
cbrt(27), and ztcl gives 3.0.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 only.
- Since
- ztcl 1.0.0-beta.1