Math Illogic

I just wanted to be sure that both of these statements are equivalent:
1
2
3
4
    if (b*1.25>=d>1.05)
    {
            // Do stuff
    }

is the same thing as:
1
2
3
4
    if (b*1.25>=d && d>1.05)
    {
            // Do stuff
    }

right? Any help would be greatly appreciated!
Last edited on
They are not equivalent.

1
2
3
4
5
6
7
8
9
10
11
// if( ( (b*1.25) is greater than d ) and ( d is greater than 1.05 ) )
if (b*1.25>=d && d>1.05)
{
     // do stuff
}

// if( false ) // (b*125 >= d ) is either true (1) or false (0)
if (b*1.25>=d>1.05)  // neither 1 nor 0 is greater than 1.05
{
     // do stuff
}
Topic archived. No new replies allowed.