Eqv Function

Purpose

Returns the bit-wise equivalent of two bit patterns.

Syntax

int = i Eqv j( operator)
int = Eqv(i, j [,m,…])( function)

i, j, m:integer expression

Description

Eqv(i, j) sets in the result only the bits which are the same in both i and j. The arguments are converted to Integer before the operation is performed (using CInt).

Bit 1 Bit 2 Result
0 0 0
0 1 0
1 0 0
1 1 1

Example

Debug.Show

Trace Bin$(3, 4) // prints 0011

Trace Bin$(3 Eqv 10, 4)// prints 0110

Trace Bin$(Not (3 Xor 10), 4) // prints 0110

3 Eqv 10 returns the value -10. This result is easier to understand when all 32 bits are shown:

Debug.Show

Trace Bin$(3, 32)        // 00000000000000000000000000000011

Trace Bin$(10, 32)       // 00000000000000000000000000001010

Trace Bin$(3 Eqv 10, 32) // 11111111111111111111111111110110

Remarks

This function is equivalent to Not(Xor(i, j)).

See Also

And ,Or, Xor, Imp, Eqv, %&, |, ~, Operator Hierarchy

{Created by Sjouke Hamstra; Last updated: 04/10/2014 by James Gaite}