Skip to content

COS

Syntax

COS (X)

Versions: 8K, Extended, Disk Extended, Disk

Description

Returns the cosine of X in radians. The angle X must be specified in radians, not degrees.

The calculation of COS(X) is performed in single precision.

Example

10 X = 2 * COS(.4)
20 PRINT X
RUN
1.84212
Ok

To convert degrees to radians, multiply by π/180 (approximately 0.0174533):

10 PI = 3.141592653589793#
20 DEG = 45
30 RAD = DEG * PI / 180
40 PRINT "COS("; DEG; " degrees) ="; COS(RAD)
RUN
COS( 45  degrees) = 0.707107
Ok

See Also

  • ABS - Return the absolute value of a number (removes negative sign)
  • ATN - Returns the arctangent of X in radians
  • EXP - Returns e to the power of X
  • FIX - Returns the truncated integer part of X
  • INT - Return the largest integer less than or equal to a number (floor function)
  • LOG - Returns the natural logarithm of X
  • RND - Returns a random number between 0 and 1
  • SGN - Returns the sign of X (-1, 0, or 1)
  • SIN - Returns the sine of X in radians
  • SQR - Returns the square root of X
  • TAN - Returns the tangent of X in radians