Is Xor an operator or a function?

Posted on 2005-04-01
Medium Priority
Last Modified: 2008-02-01
I learned in school Xor as:

True True = False
True False = True
False True = True
False False = False

I thought of the Xor operator as a operator but found it acts like a function.

I use a Xor b and I get c
a Xor c = b
b Xor a = c
b Xor c = a
c Xor a = b
c Xor b = a

15 Xor 100 = 107
15 Xor 107 = 100
100 Xor 15 = 107
100 Xor 107 = 15
107 Xor 15 = 100
107 Xor 100 = 15

What is the math formula?
Question by:rcherne1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 13

Accepted Solution

rettiseert earned 2000 total points
ID: 13685371
XOR is an operator

If you use numbers with XOR in VB, XOR compares every bit of each number and returns another number.
Use the windows cientific calculator and you'll get the same result.


15 XOR 100 = 107

Decimal       Binary (bits)
 15        =    00001111
100        =   01100100

So VB compares each bit of each number:

xor   01100100

And if you convert 01101011 to decimal then you get 107

Author Comment

ID: 13685423
Thanks rettiseert I was racking my brain trying to figure this out!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question