COS Function [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
COS Function
The COS function returns the cosine of an angle. The function type is
numeric.
Syntax
FUNCTION COS (parameter-1)
Parameters
parameter-1 The size of an angle in radians. Must be class
numeric.
Return Value
The value returned is the approximation of the cosine of parameter-1 and
is between -1 and 1, inclusive. The value returned is numeric.
Example
77 ANGLE-RADIANS PIC S99V9(5) VALUE 3.14159.
77 COS-OF-ANGLE PIC S9V9(5) VALUE ZERO.
:
COMPUTE COS-OF-ANGLE = FUNCTION COS (ANGLE-RADIANS).
DISPLAY ANGLE-RADIANS.
DISPLAY COS-OF-ANGLE.
DIVIDE ANGLE-RADIANS BY 4 GIVING ANGLE-RADIANS.
COMPUTE COS-OF-ANGLE = FUNCTION COS (ANGLE-RADIANS).
DISPLAY ANGLE-RADIANS.
DISPLAY COS-OF-ANGLE.
The above example displays the following:
+03.14159
-0.99999
+00.78539
+0.70711
MPE/iX 5.0 Documentation