mercredi 21 mars 2018

c- How to compare double Variables for if Statement

i have a question concerning the comparison of double variables. I have a double variable and i want to compare it with a double value in a matrix as followed

if(x<=coeff[0][0])
{ 
    j=0; //for instance
}
else if(x>coeff[0][1])
{
     j=1;
}
else
{
     j=2;
}

x is a double variable and coeff matrix is also double. Somehow my programm only arrives to the else statements and skips th if and else if. Any idea how to fix this? Thank you very much in advance

Aucun commentaire:

Enregistrer un commentaire