tcl::mathfunc tanh
Gives the hyperbolic tangent of a number.
tcl::mathfunc::tanh NUMBER
expr {tanh(NUMBER)}
Description
Gives the hyperbolic tangent of NUMBER, from -1 to 1. A large argument gives 1.0 or -1.0.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| NUMBER | number | required | Any number. |
Returns
A float from -1 to 1.
Examples
% expr {tanh(1)}
0.7615941559557649
% expr {tanh(1000)}
1.0
Errors
# Tcl 9.1 only
% expr {tanh("x")}
cannot use non-numeric string "x" as operand of "tanh"
-errorcode ARITH DOMAIN {non-numeric string}
# Tcl 8.6 only
% expr {tanh("x")}
can't use non-numeric string as operand of "tanh"
-errorcode ARITH DOMAIN {non-numeric string}
% expr {tanh()}
not enough arguments for math function "tanh"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1