# KNIME 3.6.0: Suprising behaviour of if ( 1 && \$A\$,...) in Math Formula node

I’m observing a suprising behaviour using a Math Formula node, that seems to be in line with the documentation but violates the principle of least suprise (at least for me):

Having a column A with double values including negative values, the behaviour of the following to expressions in a Math Formula node is different:

1. if(\$A\$,1,0) results in 1 for negative values of \$A\$
2. if(1 && \$A\$,1,0) results in 0 for negative values of \$A\$

So the && seems to change the way true and false are evaluated as compared to the “pure” \$A\$, which I consider counterintuitive.

Is it only me?

Regards,
Felix

Hi Felix,

the operator && is explained as follows: “1 if both operands are not 0, else 0.”
So in the case of \$A\$ && 1, the result is always 1, if \$A\$ is not equal to 0.

The if function on the other hand decides if a value is smaller or bigger than zero.

I will add some more description to the if function. Thanks for reporting.
Cheers, Iris

Hi Iris,

thank you for the explanation. I appreciate an improvement of the documentation.
Nevertheless the fact that
if(\$A\$ && 1, …, …) != if(\$A\$, …, …)
is something that seems to be unique to KNIME. At least I don’t know a tool/language where this is the case. So it might be worth considering a change to that behavior to avoid surprising people whose assumptions about if and && are different.

Cheers,
Felix