beetlebug▾
/

tcl::mathfunc exp

Gives e to the power of a number.

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

Description

Gives e raised to NUMBER. A result too large for a double is Inf, and a result too small is 0.0.

Arguments

ArgumentTypeDefaultDescription
NUMBERnumberrequiredThe exponent.

Returns

A float, 0 or more.

Examples

% expr {exp(0)}
1.0

% expr {exp(1)}
2.7182818284590455

% expr {exp(1000)}
Inf

% expr {exp(-1000)}
0.0

Errors

# Tcl 9.1 only
% expr {exp("x")}
cannot use non-numeric string "x" as operand of "exp"
-errorcode ARITH DOMAIN {non-numeric string}

# Tcl 8.6 only
% expr {exp("x")}
can't use non-numeric string as operand of "exp"
-errorcode ARITH DOMAIN {non-numeric string}

% expr {exp()}
not enough arguments for math function "exp"
-errorcode TCL WRONGARGS

Facts

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

See also