PC Logo Wiki
Advertisement

Syntax

LOGXOR integer1 integer2

Explanation

LOGXOR outputs the bitwise logical XOR of its two inputs. Each input is expressed internally as a sixteen digit binary number. A logical XOR operation is performed on the pair of binary digits in each position, resulting in a sixteen bit integer.

The logical XOR operation is defined on the binary digits 0 and 1 as follows:

LOGXOR 0 0 = 0

LOGXOR 1 0 = 1

LOGXOR 0 1 = 1

LOGXOR 1 1 = 0

See also LOGAND, LOGNOT, and LOGOR.

Examples

? LOGXOR 2 1

Result: 3

?

2 in base 10 is 10 in base 2; 1 in base 10 is 01 in base 2. In the 1's place, LOGXOR 0 1 = 1. In the 2's place, LOGXOR 1 0 = 1. Thus, 11 base 2 is obtained. 11 in base 2 is 3 in base 10.

? LOGXOR 2 3

Result: 1

?

2 in base 10 is 10 in base 2; 3 in base 10 is 11 in base 2. In the 1's place, LOGXOR 0 1 = 1. In the 2's place, LOGXOR 1 1 = 0. Thus, 01 base 2 is obtained. 01 in base 2 is 1 in base 10.

Advertisement