+ 3

question on numeric operation

when i type in 3^7 it brings 4 how??

2nd Jul 2018, 5:06 PM
ian kabaka🇰đŸ‡Ș
ian kabaka🇰đŸ‡Ș - avatar
2 Answers
+ 7
^ is the xor operation. 3=0011 7=0111 4=0100 xor table a b r 0 0 0 0 1 1 1 0 1 1 1 0 If the bits are the same, the result is 0. If the bits are different, the result is 1.
2nd Jul 2018, 5:28 PM
John Wells
John Wells - avatar
+ 5
^ is Bitwise Exclusive OR. It returns true only when two corresponding bits are different. For example: 3 in binary is 00000011 7 in binary is 00000111 Result: 00000100 Because only this ↑ bit is different (remember 1 == true) in binary form of 3 and 7.
2nd Jul 2018, 5:27 PM
777
777 - avatar