conditional statements not equivalent - why?

Status
Not open for further replies.

oddson

Well-known member
conditional statements not equivalent - why? (solved)

I've not extracted this to a minimal example in case there's an obvious answer (obvious to others that is :) )

These two conditional statements don't seem to function the same.

if (v0D>>3 - v0>>3 != 0)

if (v0D>>3 != v0>>3)


The first one works as expected and resolves as true only when the two variables don't bit shift to the same value.

But the second one seems to be true when it should not be... is there something about the bit-shift operator that makes this so or some other thing I should know?

p.s - ... if no one can tell me I can try to set up a minimal script to demonstrate the behaviour
 
Last edited:
Try : if ((v0D>>3) != (v0>>3))

Tried many combinations and nothing behaved as expected... then I noticed I was using the wrong variable.

I suspect it is a precedence order thing and parenthesis will make it work as expected... as soon as I sort out what that should be.

Still not sure why the first one seemed to work when it should not have but it may be some math equivalence I have not noticed.

Thanks.
 
Status
Not open for further replies.
Back
Top