beetlebug▾
/

tcl::mathfunc sin

Gives the sine of an angle in radians.

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

Description

Gives the sine of RADIANS. An infinite angle is a domain error.

Arguments

ArgumentTypeDefaultDescription
RADIANSnumberrequiredThe angle, in radians.

Returns

A float from -1 to 1.

Examples

% expr {sin(0)}
0.0

% expr {sin(3.141592653589793 / 2)}
1.0

Errors

% expr {sin(Inf)}
domain error: argument not in valid range
-errorcode ARITH DOMAIN {domain error: argument not in valid range}

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

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

Facts

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

See also