To: J3 07-329
From: Bill Long
Subject: Bitwise compare intrinsics
Date: 2007 November 09
References: J3/07-007r3, WG5/N1695, J3/07-326
Discussion
Part 2 of paper N1695 lists new intrinsics, BGE, BGT, BLE, BLT, to be
added to enable bitwise compare operations that were deleted as
intrinsic operations when the BITS data type was deleted. Edits are
provided for the descriptions of these functions.
Edits to 07-007r3:
[342:Table 13.1] In Table 13.1 "Standard generic intrinsic procedure
summary", add the following new entries following the entry for
BESSEL_YN:
"BGE (I, J) E True if and only if I is bitwise greater than
or equal to J.
BGT (I, J) E True if and only if I is bitwise greater than J.
BLE (I, J) E True if and only if I is bitwise less than
or equal to J.
BLT (I, J) E True if and only of I is bitwise less than J."
[358:26+] Following 13.7.25 "BESSEL_YN...", add 4 new subclauses:
"13.7.25a BGE (I, J)
Description. True if and only if I is bitwise greater than or
equal to J.
Class. Elemental.
Arguments.
I shall be of type integer or a .
J shall be of type integer or a .
Result Characteristics. Default logical.
Result Value. The result is true if the value of the binary integer
with the same bit representation as that of I interpreted as a bit
sequence is greater than or equal to the value of the binary integer
with the same bit representation as that of J interpreted as a bit
sequence; otherwise the result is false.
The model for the interpretation of an integer value as a sequence of
bits is in 13.3.
13.7.25b BGT (I, J)
Description. True if and only if I is bitwise greater than J.
Class. Elemental.
Arguments.
I shall be of type integer or a .
J shall be of type integer or a .
Result Characteristics. Default logical.
Result Value. The result is true if the value of the binary integer
with the same bit representation as that of I interpreted as a bit
sequence is greater than the value of the binary integer with the same
bit representation as that of J interpreted as a bit sequence;
otherwise the result is false.
The model for the interpretation of an integer value as a sequence of
bits is in 13.3.
13.7.25c BLE (I, J)
Description. True if and only is I is bitwise less than or
equal to J.
Class. Elemental.
Arguments.
I shall be of type integer or a .
J shall be of type integer or a .
Result Characteristics. Default logical.
Result Value. The result is true if the value of the binary integer
with the same bit representation as that of I interpreted as a bit
sequence is less than or equal to the value of the binary integer with
the same bit representation as that of J interpreted as a bit
sequence; otherwise the result is false.
The model for the interpretation of an integer value as a sequence of
bits is in 13.3.
13.7.25d BLT (I, J)
Description. True if and only if I is bitwise less than J.
Class. Elemental.
Arguments.
I shall be of type integer or a .
J shall be of type integer or a .
Result Characteristics. Default logical.
Result Value. The result is true if the value of the binary integer
with the same bit representation as that of I interpreted as a bit
sequence is less than the value of the binary integer with the same
bit representation as that of J interpreted as a bit sequence;
otherwise the result is false.
The model for the interpretation of an integer value as a sequence of
bits is in 13.3."
-------------------------------------------
Alternate wordings for the "Result Value" description which follows the
directions in N1695 more closely:
For BGE:
"Result Value. Each of the arguments is interpreted as a sequence of
bits. If the two sequences have different lengths, the shorter one is
padded with zeros on the left to match the length of the longer
one. The result is true if the bit sequence of I has a one bit at the
leftmost position where the corresponding bits in the sequences are
unequal, or all of the corresponding bits are the same; otherwise the
result is false.
The model for the interpretation of an integer value as a sequence of
bits is in 13.3."
For BGT:
"Result Value. Each of the arguments is interpreted as a sequence of
bits. If the two sequences have different lengths, the shorter one is
padded with zeros on the left to match the length of the longer
one. The result is true if the bit sequence of I has a one bit at the
leftmost position where the corresponding bits in the sequences are
unequal and the corresponding bits are not all the same; otherwise the
result is false.
The model for the interpretation of an integer value as a sequence of
bits is in 13.3."
For BLE:
"Result Value. Each of the arguments is interpreted as a sequence of
bits. If the two sequences have different lengths, the shorter one is
padded with zeros on the left to match the length of the longer
one. The result is true if the bit sequence of I has a zero bit at the
leftmost position where the corresponding bits in the sequences are
unequal, or all of the corresponding bits are the same; otherwise the
result is false.
The model for the interpretation of an integer value as a sequence of
bits is in 13.3."
For BLT:
"Result Value. Each of the arguments is interpreted as a sequence of
bits. If the two sequences have different lengths, the shorter one is
padded with zeros on the left to match the length of the longer
one. The result is true if the bit sequence of I has a zero bit at the
leftmost position where the corresponding bits in the sequences are
unequal and the corresponding bits are not all the same; otherwise the
result is false.
The model for the interpretation of an integer value as a sequence of
bits is in 13.3."