The MATH instruction performs all branches, so IF(A, B, C) will always evaluate A, B, and C.
However, if you move the IF functionality to Ladder Logic (I like using the NOT contact for IF/THEN/ELSE in Ladder), it will do what you expect (see attachment)