Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982)
by threatofrain on Friday January 05, 2024 @05:56PM
(#38886194)
Isn't it x ^ y which is like x + y?
[ Parent
| on HN ]
Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982)
by pcwalton on Friday January 05, 2024 @06:06PM
(#38886286)
Yeah, | is technically x + y + x*y over GF(2) (this is the Boolean ring to Boolean algebra relation [1]). The GP is still a good way to remember the precedence though.
[1]: https://en.wikipedia.org/wiki/Boolean_ring#Relation_to_Boole...
Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982)
by o11c on Friday January 05, 2024 @07:45PM
(#38887071)
^ is like + when operating over bits, since (bit)2 == 0
| is like + when operating over bools, since (bool)2 == 1