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

Intrinsic Functions
HP COBOL Manual for TNS/E Programs520347-003
14-55
SQRT Function
SQRT Function
SQRT, a numeric function, returns a value that approximates the square root of its
argument.
argument
is a numeric argument whose value is zero or positive.
The returned value is approximately:
Example 14-38. SQRT Function
Code:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PICTURE S9V99.
PROCEDURE DIVISION.
MOVE FUNCTION SQRT (0) TO A.
DISPLAY A.
MOVE FUNCTION SQRT (25) TO A.
DISPLAY A.
MOVE FUNCTION SQRT (100) TO A.
DISPLAY A.
MOVE FUNCTION SQRT (47) TO A.
DISPLAY A.
MOVE FUNCTION SQRT (7.923) TO A.
DISPLAY A.
Output:
00.000
05.000
10.000
06.855
02.814
( )
SQRTFUNCTION argument
VST461.vsd
argument