COBOL Manual for TNS/E Programs (H06.03+)

Intrinsic Functions
HP COBOL Manual for TNS/E Programs520347-003
14-15
COS Function
COS Function
COS, a numeric function, returns a value that approximates the cosine of the angle or
arc (in radians) specified by its argument.
argument
is a numeric argument.
The returned value approximates the cosine of the value of argument. It is a floating-
point number in the range -1 to +1. It has no implied decimal point and is precise to
approximately 14 digits.
Example 14-7. COS Function
Code:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PICTURE S9V99.
PROCEDURE DIVISION.
MOVE FUNCTION COS (-10) TO A.
DISPLAY A.
MOVE FUNCTION COS (0) TO A.
DISPLAY A.
MOVE FUNCTION COS (.25) TO A.
DISPLAY A.
MOVE FUNCTION COS (15.5) TO A.
DISPLAY A.
MOVE FUNCTION COS (45) TO A.
DISPLAY A.
Output:
-0.83
1.00
0.96
-0.97
0.52
( )
COSFUNCTION argument
VST426.vsd