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

5- 14
Examples
OPTION BASE 1 is assumed.
A(2,2): 1 2 D(3,3): 1 0 1 E(2,2): 8 3
4 5 3 5 7 4 7
9 0 9
DET(A) = -3
DET(D) = 0
DET(E) = 44
DOT
The DOT function returns the dot product, or inner product, of two
vectors. The elements of the two vectors must be of the same type. If
they are short integer arrays, the result is an integer; otherwise, the
result is the same type. Intermediate calculations for computing the DOT
product of two short decimal type vectors are performed after converting
each of the appropriate elements to decimal type values. Therefore, in
compiled programs, short decimal overflow is reported as decimal
overflow. The result is of the default numeric type.
Syntax
DOT(
num_vector1
,
num_vector2
)
Parameters
num_vector1
A numeric one dimensional array.
num_vector2
A numeric one dimensional array.
Examples
OPTION BASE 1 is assumed.
A(4) = 1 2 3 4
B(4) = 2 2 2 2
DOT (A,B) = 1*2+2*2+3*2+4*2= 21
DROUND
The DROUND function rounds a number to a specified number of digits. The
result is of type DECIMAL.
Syntax
DROUND(
n1
,
n2
)
Parameters
n1
The number to be rounded. Although this can be of any
numeric type, it is converted to DECIMAL.
n2
The number of digits that
n1
is to be rounded to.
Examples
10 A = DROUND(.3214,3) !A = .321
20 B = DROUND(.3215,3) !B = .322
30 C = DROUND(5.07,2) !C = 5.1
ERRL
The ERRL function returns information about the last error trapped by an
ON ERROR statement. It returns the line number that the error occurred
in.
Syntax
ERRL
Example
100 ON ERROR CALL Fixit