# Name for this logic operation [closed]

I'm from math.stackexchange and I wanted to know the name of an operation on multiple variables. I thgouth what I wanted was the XOR gate, but this is not the case. When I looked on this site I noticed the XOR truth table was this:

$$\begin{matrix} FFF & 0 \\ FFT & 1 \\ FTF & 1 \\ FTT & 0 \\ TFF & 1 \\ TFT & 0 \\ TTF & 0 \\ TTT & 1 \end{matrix}$$ I would have excpeted, and what I'm after is, this $$\begin{matrix} FFF & 0 \\ FFT & 1 \\ FTF & 1 \\ FTT & 0 \\ TFF & 1 \\ TFT & 0 \\ TTF & 0 \\ TTT & 0 \end{matrix}$$

Is there a name for this second table as that is what I would like to use and I would like to stick to convention. Thanks in advance, Ben

• In the second table, the three inputs are not commutative. Is that really what you want? – CL. Jun 6 '19 at 7:22
• Why do you expect 1 xor 1 xor 1 to be 0? – Steve G Jun 6 '19 at 7:45
• By asking for a name for that truth table, I would hope I'm being clear that I don't think it is called XOR. I have shown that I understand XOR not to be that truth table and that I wanted a name for the second truth table. If one doesn't exist, I will make one up for what I am doing. – Ben Crossley Jun 6 '19 at 8:07
• Possible duplicate of How is an XOR with more than 2 inputs supposed to work? – Elliot Alderson Jun 6 '19 at 11:58
• Probably needs to go back to maths yhis is nothing to do with EE. – RoyC Jun 7 '19 at 11:00

I think this truth table would result in something like the circuit below, unless I've made a mistake :)

As you mentioned it would be like a 3 Gate XOR (what's represented by your first table) but you have to exclude the case where all three inputs are 1 "True".

simulate this circuit – Schematic created using CircuitLab

This construct doesn't have a specific name it's XOR(NOT(AND(A,B,C)), XOR(A,B,C))

• Thank you for taking the time to make this however, the answer I am looking for is in the form of a name. I.e. ONE(A,B,C) – Ben Crossley Jun 6 '19 at 8:16
• This construct doesn't have a specific name it's XOR(NOT(AND(A,B,C)), XOR(A,B,C)) – po.pe Jun 6 '19 at 8:27

No, there is no name for that custom logic operation.

You'll have to implement the function below in whatever environment you are working in.

$$\ f(a,b,c)=\begin{cases} \displaystyle 0 & ,\text{when } abc=1 \\ \displaystyle \text{xor}(a,b,c) & ,\text{otherwise} & \end{cases}\$$

Or, if you don't want to deal with cases, this function gives the same answer:

$$\ f(a,b,c)=\text{xor}(a,b,c)(1-abc) \$$

• Sorry, but your definition of XOR for >2 inputs is not a universal standard. Some definitions of such an XOR function specify that the output is true when one and only one input is true. – Elliot Alderson Jun 6 '19 at 12:01
• @ElliotAlderson Hmm, it appears that it's up for interpretation according to your answer. And OP has shown how he views xor for 3 inputs with his truth table, which is the one I agree with, and all computers agree with. And since OP is the one that is going to use it then I suppose it's up to his interpretation which matters. - I would love to see any computational execution in any modern programming language that evaluates $1\oplus1\oplus1$ to anything other than 1. In my world xor for inputs >2 are just a sum of the ones modulo 2. I mean, this is how parity is calculated. – Harry Svensson Jun 6 '19 at 12:14
• Take a look at the answers to electronics.stackexchange.com/questions/93713/… The OP asked about the convention for the name of the function, and according to some sources (such as the IEEE) the second function is the real XOR. By the way, the IEEE standards recommend a different symbol for parity functions. Can you provide citations for your claim that "all computers" agree with your definition? – Elliot Alderson Jun 6 '19 at 12:20
• @ElliotAlderson No, I don't have any citation anywhere, unless you want me to start linking to datasheets for microcontrollers, I just know what happens if I have three registers, a, b, c, with LSB set to 1 and perform a^b^c then I get 1. And I've so far never come across any microcontroller / processor that gives me 0. Nor have I come across that when dealing with FPGA's, CRC, modulo 2 arithmetic or other boolean logic or truth tables for that matter. But fine, you can call it xor if you want, I won't. – Harry Svensson Jun 6 '19 at 12:29
• I think the point is that $\mathrm{xor}(A,B,C)$ is not necessarily the same as $\mathrm{xor}(\mathrm{xor}(A,B),C)$. When you write assembly code or HDL you always use binary xor operators, so the question doesn't come up. – Elliot Alderson Jun 6 '19 at 15:56

Yes, this gate is called an exclusive-OR (XOR) gate. Some definitions of the XOR gate that has more than 2 inputs state that the output is true if one and only one input is true. This has been discussed at some length before: How is an XOR with more than 2 inputs supposed to work?