COBOL Manual for TNS and TNS/R Programs
Intrinsic Functions
HP COBOL Manual for TNS and TNS/R Programs—522555-006
14-8
ACOS Function
ACOS Function
ACOS, a numeric function, returns a value in radians that approximates the arccosine
of its argument.
argument
is a numeric argument whose value is in the range -1 to +1.
The returned value approximates the arccosine of the value of argument. It is a
floating-point number in the range zero to pi. It has no implied decimal point and is
precise to approximately 14 digits.
Note. This function requires the CRE. To use this function in a TNS HP COBOL program,
compile the program with the directive ENV COMMON.
Example 14-1. ACOS Function
Code:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PICTURE S9V99.
PROCEDURE DIVISION.
MOVE FUNCTION ACOS (-1) TO A.
DISPLAY A.
MOVE FUNCTION ACOS (.25) TO A.
DISPLAY A.
MOVE FUNCTION ACOS (.5) TO A.
DISPLAY A.
MOVE FUNCTION ACOS (.75) TO A.
DISPLAY A.
MOVE FUNCTION ACOS (1) TO A.
DISPLAY A.
Output:
3.14
1.31
1.04
0.72
0.00
( )
ACOSFUNCTION argument
VST421.vsd