COS

From QB64 Wiki
Revision as of 16:47, 31 August 2009 by 63.116.159.137 (talk) (Created page with 'Purpose: To return the cosine of the range of x. '''Syntax:''' COS(x) '''Comments:''' x must be the radians. COS is the trigonometric cosine function. To convert from degrees t…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose: To return the cosine of the range of x.

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

RUN

1.842122

Example 2:

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

RUN

-1
-1