contents.gifindex.gif

Set Assignment and Comparison

Values and sets of values can be assigned and compared to a set. are given in the table below. For example,

sigset = [1,1,0] & [0,1,1];

results in sigset being assigned the value, [0,1,0]. The set assignment

[a,b] = c & d;

is the same as the two assignments

a = c & d;
b = c & d;

Numbers in any representation can be assigned or compared to a set. The preceding set equation could have been written as

sigset = 6 & 3;

When numbers are used for set assignment or comparison, the number is converted to its binary representation and the following two rules apply:

If the number of significant bits in the binary representation of a number is greater than the number of elements in a set, the bits are truncated on the left.

If the number of significant bits in the binary representation of a number is less than the number of elements in a set, the number is padded on the left with leading zeroes.

Thus, the following two assignments are equivalent:

[a,b] = ^B101011; "bits truncated to the left
[a,b] = ^B11;

And so are these two:

[d,c] = ^B01;
[d,c] = ^B1; "compiler will add leading zero


See Also

Supported Set Operations