+ 3
question on numeric operation
when i type in 3^7 it brings 4 how??
2 Respostas
+ 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.
+ 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.