lundi 20 mars 2017

Why is (0.452888==0.452888) false in my code?

I am writing some C++ code in openCV, but there is this one thing I totally don't understand. I have tried coding it in multiple ways, but the result is always the same: although hu.at(0) and hues.at(0) seamingly contain the same value, i.e. the if statement is never true! Why? How can I solve this

vector <double> hu;
vector<double> hues;

if(hu.at(0)==hues.at(0))
{
   cerr<<"OK"<<endl;
}
else{
cerr<<"NOK, hues[0]: "<<hues.at(0)<<endl;
cerr<<"hu[0]: "<< hu[0]<<endl;
}

Output:

NOK, hues[0]: 0.452888
hu[0]: 0.452888

context: http://ift.tt/2ntzCCu

Aucun commentaire:

Enregistrer un commentaire