I made a prototype code on python to see if the logic works and later coded it in c++. But for some reason the python version and c++ version return different results. I am not able to figure out why that is the case.
I went through this particular logical equation many times and made sure they are exactly the same, excluding differences like (or,||) and (and,&&).
python
i = -6
j = -5
pos_i = 0
pos_j = 0
print((i%2==0)and((((i/2)%2==0)and(j%2==0))or(((i/2)%2==1)and(j%2==1))))
c++
int i = -6;
int j = -5;
int pos_i = 0;
int pos_j = 0;
cout << (i%2==0)&&((((i/2)%2==0)&&(j%2==0))||(((i/2)%2==1)&&(j%2==1)));
expected:-
python===> True
c++=====> 1
actual:-
python===> True
c++=====> 0