I came across this in my MFC app and simplified the code into this console app for this example. When I compile and run the following code in Debug mode, it gives the correct answer for i, (10). When I compile and run it in Release mode, it gives the wrong answer for i, (11). Anyone know why?


Code:
#include <iostream>
using namespace std;

void main(){
    int i;
    double yTest;

    i=0;
    yTest = 100000000.;
    while (yTest-.01 > 0.){
        yTest /= 10.;
        i++;
    }

    cout<<i<<endl;
}
VS 2003 .Net Version 7.1.3088