Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
COS Function
COS(real-expression)

Returns the cosine of the given angle, where the angle is expressed in radians.


Examples

PRINT COS(0)

Produces 1.

PRINT COS(PI# / 2)

Produces approximately 0.

PRINT COS(PI#)

Produces -1.

REM Plot cosine values for multiples of 45 degrees
FOR d = 0 TO 360 STEP 45
r# = d * PI# / 180
PRINT "COS("; d; "°) = "; COS(r#)
NEXT

Notes

  • Argument is in radians. Convert degrees to radians with:

    radians# = degrees * PI# / 180
  • Return value is a real number between -1 and 1.
  • Related inverse function: ACS.

See also: SIN · TAN · ACS · ATAN