Weird Stuff with a if statement

Either i am seing things but i dont understand why a condtional statement is satisfied upon exection of the code, while in reality it is not.

1
2
3
4
5
6
double myVar1=MyFunc1();
double myVar2=MyFunc2();
if(myVar1>=myVar2)
{
...


when i debug, myVar1 is -0.8010, myVar2 is -0.2001. Which means that myVar2 is larger than myVar1 , which obviously does not satisfy the if statement, yet the code think it is statisfied and steps into the block after the if statement!!!!???????
You must be looking at it wrong. There's no way that could be happening.

EDIT: how are you viewing these numbers? Perhaps it's being printed in scientific notation and the exponent is throwing you off.
Last edited on
What type does MyFunc1() and MyFunc2() return? And when in the execution are you reading the values?
I am using VS2010 debugger, i placed a breakpoint at the conditional statement, hover the cursor over the myVar1 and myVar2.
MyFunc1 and MyFunc2 are fucntions returning values of type double.
Can you copy the actual message that VSE2010 prints?
What do you mean by message?
when i hit the breakpoint at the if statement, then press F11 (step into), the code enter the block after if statement even though the condition is not true
Are you sure you didn't just accidentally write <=?

@Ben - his debugger doesn't give him any messages.
Topic archived. No new replies allowed.