我有这个逻辑运算符表达式:
!(!(a != b) && (b > 7))
如何简化并找到相应的内容?
答案 0 :(得分:2)
!(!(a != b) && (b > 7))
!!(a != b) || !(b > 7)
a != b || b <= 7
答案 1 :(得分:0)
正如其他人所说:Demorgan's Laws
!(!(a != b) && (b > 7)) // x != y --> !(x == y)
!(!!(a == b) && (b > 7)) // !!x --> x
!((a == b) && (b > 7)) // !(x && y) --> !x || !y
!(a == b) || !(b > 7) // !(x == y) --> x != y;; !(x > y) --> x <= y
(a != b) || (b <= 7)