Floating pont comparision


//code

double det;

double psiInv[2][2];

det = psiInv[0][1] * psiInv[1][1]

if(det == 0.0)
{
std::cout<<"Both are equal"<<std::endl;
}
else
{
std::cout<<"Both are not equal"<<std::endl;
}


The above floating point comparison is not acceptable and compiler gives warning as floating point comparision is not done.

Please help me out.
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Long story short: you can't shouldn't compare floating point using == or !=.
Topic archived. No new replies allowed.