HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

5- 36
Syntax
SQR(
n
)
Parameters
n
The number to be evaluated. This is of type REAL.
Examples
10 A = SQR(25) !A = 5
SREAL
The SREAL function converts a number to a short real. The result is of
type SHORT REAL.
Syntax
SREAL(
n
)
Parameters
n
The number to be converted. This can be of any numeric
type.
Examples
10 A = SREAL(4) !A = 4.0000
SUM
The SUM function returns the sum of the elements in a numeric array. If
the array is a short integer array, the result is an integer; otherwise,
the result is the same type as the array.
Syntax
SUM(
num_array
)
Parameters
num_array
Structured collection of variables of the same numeric
type. The structure is determined when the array is
declared.
Examples
OPTION BASE 1 is assumed.
A(2,2): 1 2 B(2,4): 1 2 3 4 C(4,3,2): 1 2 0 4 0 0 1 2
4 5 5 6 7 8 5 1 1 0 4 5 0 0
2 0 3 2 1 2 0 1
D(3,3): 1 0 1 E(2,2): 8 3 F(5): 5 4 3 2 1
3 5 7 4 7
9 0 9
SUM(A) = 1+2+4+5 = 12
SUM(B) = 1+2+3+4+5+6+7+8 = 36
SUM(C) = 1+2+4+5+1+1+2+3+2+1+2+4+5+1+2+1 = 35
SUM(D) = 1+1+3+5+7+9+9 = 35
SUM(E) = 8+3+4+7 = 22
SUM(F) = 5+4+3+2+1 = 15