& has higher precedence than ==, so the expression
a == 2.0 & b
is the same as
a == (2.0 & b)
You get the error because bitwise and is not defined for a floating point scalar and a boolean array.
Add parentheses to get what you expected:
(a == 2.0) & b