beetlebug▾
/

tcl::mathfunc atan

Gives the arc tangent of a number, in radians.

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

Description

Gives the angle from -pi/2 to pi/2 whose tangent is NUMBER. Each number is valid: atan(-Inf) is -pi/2. For the angle of a point, use atan2.

Arguments

ArgumentTypeDefaultDescription
NUMBERnumberrequiredAny number.

Returns

A float from -pi/2 to pi/2.

Examples

% expr {atan(1)}
0.7853981633974483

% expr {atan(-Inf)}
-1.5707963267948966

Errors

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

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

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

Facts

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

See also