News for hackers. Stuff that matters.
Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982) by dataflow on Friday January 05, 2024 @05:45PM (#38886076)
a * b * c is only nonzero if all of a, b, c are nonzero. That's AND, and should be pretty intuitive.

a + b + c is nonzero if any of them are nonzero. (Remember each value is either 0 or 1.) So that's the intuition for OR.

Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982) by explaininjs on Friday January 05, 2024 @05:50PM (#38886124)
a+b+c is nonzero if any of a or b or c are nonzero.
Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982) by dataflow on Friday January 05, 2024 @05:51PM (#38886145)
Yeah I just added that. I was hesitant initially cause you have to also note they're nonnegative, and that you're treating them like real numbers rather than mod 2.
Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982) by explaininjs on Friday January 05, 2024 @11:54PM (#38888550)
Natural numbers are the natural numbers for me! (ISO 80000-2, of course)