vector<double> pvec;
double firstnode=0.0;
for(iter2=svec.begin(); iter2!=svec.end(); iter2++)
{
double price= 0.0;
string sFiyat = iter2->substr(13);
stringstream(sFiyat)>>price;
price=log(price);
if (iter2==iter)
{
firstnode = price;
}
price -= firstnode;
pvec.push_back(price);
}
I got the code above and there is a miracalous difference in debug and release modes. The algorithm aims to make the first element of the vector equal to zero and then finds the differences of the logarithms of the first element with other elements.
In debug mode, this gives the result that I desire and the first element of the vector is always equal to zero. But when I switch to the release mode the first element of the vector is equal to some small number such as 8.86335e-019.
And that's not all. When I put the line "cout << price << endl;" after the line "price=log(price);" then the result I got from the release version is same with the one from the debug mode. Any explanations?