top | item 42041664

(no title)

irishsultan | 1 year ago

I don't see how you could interpret "a != b != c" as equivalent to "not (a == b == c)" in the first place. In the first expression a doesn't equal b and b doesn't equal c (no restriction on a and c). In the second expression you could have a == b, but b != c (and vice versa), clearly that's not equivalent to the first expression.

discuss

order

the5avage|1 year ago

"a == b" is the same as "not (a != b)"

Maybe I'm simple minded though.

int_19h|1 year ago

If you treat each "!" as a NOT, then (a != b != c) has two NOTs, but !(a == b == c) has a single one, so this is a bit like expecting that !(a && b) is the same as (!a && !b).

Doxin|1 year ago

"a == b == c" translates to "a == b and b == c", similarly "a != b !=c" translates to "a != b and b != c"