Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

incorrect description of the XOR operator on BitMath Playground page

Open brk9394 opened this issue 12 years ago • 3 comments

incorrect description of the XOR operator in the following webpage: http://playground.arduino.cc/Code/BitMath#bitwise_xor

current wording: "The bitwise XOR operator is written using the caret symbol ^. This operator is very similar to the bitwise OR operator |, only it evaluates to 0 for a given bit position when both of the input bits for that position are 1"

suggested wording: "The bitwise XOR operator is written using the caret symbol ^. This operator is very similar to the bitwise OR operator |, only it evaluates to 0 for a given bit position when both of the input bits for that position are either 0 or 1"

brk9394 avatar Mar 17 '14 09:03 brk9394

Hmm, the current wording is indeed wrong. However, you're new wording is slightly confusing, you could interpret it as if XOR always returns 0, since any bit is by defintion either 0 or 1. How about:

The bitwise XOR operator is written using the caret symbol ^. This operator is very similar to the bitwise OR operator |, only it evaluates to 1 for a given bit position when exactly one of the input bits for that position is 1. If both are 0 or both are 1, the XOR operator evaluates to 0.

matthijskooijman avatar Mar 17 '14 09:03 matthijskooijman

Yes, I see what you mean. Your suggestion is more clear. Thanks.

brk9394 avatar Mar 18 '14 06:03 brk9394

Thanks @matthijskooijman

For future reference, pages on playground.arduino.cc are part of a publically editable wiki.

shfitz avatar Apr 13 '14 08:04 shfitz