COS

From QB64 Wiki
Revision as of 19:12, 7 September 2009 by imported>Clippy
Jump to navigation Jump to search

Purpose: To return the cosine of the of a radian angle.

Syntax: COS(x)

Comments: x must be the radians. COS is the trigonometric cosine function. To convert from degrees to radians, multiply by π/180.

COS(x) is calculated in either single or double precision depending on its argument.

COS(4)
-.6536436
COS(4#)
-.6536436208636119

Example 1:

X = 2 * COS(.4)
PRINT X

Result: 1.842122


Example 2:

PI = 3.141593
PRINT COS(PI)
DEGREES = 180
RADIANS = DEGREES * PI / 180
PRINT COS(RADIANS)

Result:

-1
-1


See also: SIN, ATN, TAN


Navigation:

Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage