| View previous topic :: View next topic |
| Author |
Message |
Habufe Expert Cheater
Reputation: 0
Joined: 03 Sep 2007 Posts: 149 Location: http://www.SaviourFagFails.com/
|
Posted: Tue Oct 28, 2008 11:35 am Post subject: [Question] the opposite of AND |
|
|
what is the opposite of the logical AND? like for example, the opposite of or is xor because 10 or 5 = 15, and 15 xor 5 = 10.
i thought about xnor but it replaces all the bytes in the beginning to 1s and it screws up the number.
|
|
| Back to top |
|
 |
Goddess Expert Cheater
Reputation: 0
Joined: 24 Oct 2008 Posts: 194 Location: Kyoto, Japan
|
Posted: Tue Oct 28, 2008 12:35 pm Post subject: |
|
|
Correct me if I'm wrong, but if it's the same as electronics it should be "NAND" (Not/And)
Tables:
-KEY-
| Code: |
A <operator> B | result
|
| Code: |
--AND & NAND--
A AND B | C A NAND B | C
--------|-- ---------|--
0 AND 0 | 0 0 NAND 0 | 1
0 AND 1 | 0 0 NAND 1 | 1
1 AND 0 | 0 1 NAND 0 | 1
1 AND 1 | 1 1 NAND 1 | 0
--OR & NOR--
A OR B | C A NOR B | C
-------|-- --------|--
0 OR 0 | 0 0 NOR 0 | 1
0 OR 1 | 1 0 NOR 1 | 0
1 OR 0 | 1 1 NOR 0 | 0
1 OR 1 | 1 1 NOR 1 | 0
--XOR & XNOR--
A XOR B | C A XNOR B | C
--------|-- ---------|--
0 XOR 0 | 0 0 XNOR 0 | 1
0 XOR 1 | 1 0 XNOR 1 | 0
1 XOR 0 | 1 1 XNOR 0 | 0
1 XOR 1 | 0 1 XNOR 1 | 1
-NOT-
A | C
--|--
0 | 1
1 | 0
|
_________________
"unzip; strip; touch; finger; mount; fsck; more; yes; unmount; sleep" - my daily unix command list

Last edited by Goddess on Tue Oct 28, 2008 12:57 pm; edited 2 times in total |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Tue Oct 28, 2008 12:41 pm Post subject: |
|
|
XOR is not the opposite of OR:
| Code: | 5 | 6 = 7
6 ^ 7 = 1
5 ^ 7 = 2 |
Anyway, just NOT the result.
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Tue Oct 28, 2008 1:19 pm Post subject: |
|
|
| Goddess wrote: | Correct me if I'm wrong, but if it's the same as electronics it should be "NAND" (Not/And)
|
Well yeah, it's only opposite because the NOT gate inverts it.
|
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Tue Oct 28, 2008 2:00 pm Post subject: |
|
|
Do you want opposite or inverse? The property you were trying to describe between xor and or (which is not actually true) is that of being the inverse function to the other. In fact, xor is the inverse of itself. (A xor B) xor B = A; (A xor B) xor A = B;
Given "f(X) = X xor C", f(f(X)) = X;
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
| Back to top |
|
 |
92Garfield I'm a spammer
Reputation: 57
Joined: 20 Dec 2007 Posts: 5871 Location: Banana Republic Germany
|
Posted: Tue Oct 28, 2008 3:41 pm Post subject: |
|
|
i think opposite of or is not or and opposite of and is not and
1 and 1 = 1
not (1 and 1) = not 1 = 0
1 or 0 = 1
not (1 or 0) = not 1 = 0
btw xor is
A - B - C (a xor b = c)
1 - 1 - 0
1 - 0 - 1
0 - 1 - 1
0 - 0 - 0
they must be different to make xor return 1
_________________
|
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Tue Oct 28, 2008 3:50 pm Post subject: |
|
|
We need to define opposite better to have this discussion. OP seems to be talking about the inverse operation of given logical operations.
If you define opposite to mean flipped bits / opposite logical result, then NOT(f(x)) gives you that by definition.
For OR and AND, there is no inverse function though, because they are not one-to-one in their domains/ranges.
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
| Back to top |
|
 |
pkedpker Master Cheater
Reputation: 1
Joined: 11 Oct 2006 Posts: 412
|
Posted: Thu Oct 30, 2008 6:24 pm Post subject: |
|
|
opposite of AND lets see lol..
AND means checking for 2 pairs of data to be equal to something.. im guessing the opposite of it to check for data thats not equal to something? so it's a matter of changing == to != or !data == something.
I don't think a opposite exists but yah people told yah about the NOT command thats how you do it.
_________________
|
|
| Back to top |
|
 |
SXGuy I post too much
Reputation: 0
Joined: 19 Sep 2006 Posts: 3551
|
Posted: Fri Oct 31, 2008 3:43 am Post subject: |
|
|
AND - NAND
OR - NOR
XOR - XNOR
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Fri Oct 31, 2008 10:32 am Post subject: |
|
|
| SXGuy wrote: | AND - NAND
OR - NOR
XOR - XNOR |
Suppose this is right because of the NOT
|
|
| Back to top |
|
 |
SXGuy I post too much
Reputation: 0
Joined: 19 Sep 2006 Posts: 3551
|
Posted: Sat Nov 01, 2008 5:30 am Post subject: |
|
|
you would have thought they would have named it NXOR tho wouldnt you lol
|
|
| Back to top |
|
 |
|