I am having quite an ununderstable problem here.
I want my x value
to get from 0.0 to 1.0
, increasing by 0.05
.
It seems like a quite eazy thing to do. However, at the end of my loop when evaluating x <= L ( with x = 1.0 and L = 1.0)
I get a 0 value
.
I also tried hard writing L
, It does not change the behaviour.
std::ofstream& operator<<(std::ofstream& ofs, Solver& s) {
double x = 0.0;
double L = 1.0;
while( x <= L){
//Do stuff related to my project
x += 0.05;
}
std::cout << "x= : " << x << std::endl;// 1
std::cout << "L= : " << L << std::endl;// 1
std::cout << "(x <= L)= : " << (x <= L) << std::endl;// 0
std::cout << "(1 <= L)= : "<< (1 <= L) << std::endl;//1
std::cout << "(1.0 <= L)= : "<< (1.0 <= L) << std::endl;//1
std::cout << "(x <= 1)= : "<< (x <= 1) << std::endl;//0
std::cout << "(x <= 1.0) : "<< (x <= 1.0) << std::endl;//0
std::cout << "(1.0 <= 1)= : "<< (1.0 <= 1) << std::endl;//1
}
return ofs;
}
At the end of the code you can see some printing test that I have performed.
Normally all of those test results should be 1
.
Does anyone has an idea of how and why the test doesn't pass ?