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

5-3
The BINAND function returns the binary AND for two numbers. The result
of this function is a short integer that contains a one in each bit for
which the same bit in both of the arguments is a one.
It returns a short integer
R
such that:
R
(
n
) = N1(
n
) AND N2(
n
)
for all
n
in [0, 15] where N1(
n
) and N2(
n
) represent the value of bit
n
of each expression and
R
represents the short integer result of BINAND.
Syntax
BINAND(N1,N2)
Parameters
N1
Binary representation of a numeric expression.
N1
is a
short integer.
N2
Binary representation of a numeric expression.
N2
is a
short integer.
Examples
The example below shows a layout of each bit of the arguments, and the
resulting bit layout of the result.
Bit Number: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
N1= 0 1 1 0 0 1 0 1 0 0 0 1 1 1 0 1
N2= 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0
BINAND(N1,N2)=0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0
BINCMP
The BINCMP function returns the binary complement for all
R
such that
R
(
n
) = NOT N1(
n
)
for all
n
in [0, 15] where N1(
n
) represents the value of bit
n
in N1 and
R represents the short integer result of the function. HP Business
BASIC/XL stores a negative number as the two's complement of its absolute
value. The two's complement of a number is its complement or the results
of the BINCMP function, plus one.
Syntax
BINCMP(
N1
)
Parameters
N1
Binary representation of a numeric expression. This is
a short integer.
Examples
The example below shows the bit layout for the argument, N1. It shows
the bit layout for the result of the BINCOMP function.
Bit Number: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
N1= 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0
BINCMP(N1)= 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1
BINOR
The BINOR function returns the Binary OR for all
R
such that
R(
n
)=N1(
n
) OR N2(
n
)
for all
n
in [0, 15] where N1(
n
) and N2(
n
) represent the value of bit
n
in each expression and
R
represents the short integer result of the
function. That is, if a particular bit in either argument contains a
one, the resulting bit will be one. If both arguments have a zero in a
particular bit, the result will have a zero in that bit.