COS: Calculating the Cosine of an Angle

Given an angle in radians, COS calculates the cosine of the angle.

Calculate the Cosine of an Angle

COS(expression)

where:

expression

Numeric

Is an angle in radians.

Calculating the Cosine of an Angle

The following request calculates the cosine of 0, PI/2 radians, PI/4 radians, and PI radians, then calculates the arccosine of those cosines.

DEFINE FILE ggsales
PI1 = PI();
PI2 = PI()/2;
PI4 = PI()/4;
END

TABLE FILE ggsales
PRINT COMPUTE
COSINE1 = COS(0);
COSINE2 = COS(PI2);
COSINE3 = COS(PI4);
COSINE4 = COS(PI1);
BY DATE
WHERE RECORDLIMIT EQ 1
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image.

COS calculates the cosine of PI radians.

COS(PI())

The result is -1.00.