beetlebug▾
/

tcl::mathfunc tan

Gives the tangent of an angle in radians.

tcl::mathfunc::tan RADIANS
expr {tan(RADIANS)}

Description

Gives the tangent of RADIANS. Near pi/2 the result is large but finite, since no double is exactly pi/2.

Arguments

ArgumentTypeDefaultDescription
RADIANSnumberrequiredThe angle, in radians.

Returns

A float.

Examples

% expr {tan(0)}
0.0

% expr {tan(1)}
1.5574077246549023

% expr {tan(1.5707963267948966)}
16331239353195370.0

Errors

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

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

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

Facts

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

See also