lundi 4 mai 2020

If statement with double should be true

I´m debugging a part of code and found a basic if statement, which seems not to work.

if (pTran.getFieldDouble(TRANF_FIELD.TRANF_RATE_SPD, 2,"") != 0) {
...
}

where pTran.getFieldDouble(TRANF_FIELD.TRANF_RATE_SPD, 2,"") is double and in debug expressions I can see that the value is -0.001, which is correct. So, -0.001 != 0 is true and we should go into the block code. However, program jumps it over. Do you have any idea why?

I have also tried to put the whole if statement into expression, but it does not work - shows me errors_during_the_evaluation (but I can remember, that in the past I was able to check the result of "if" statement. I have forget it.)

Thanks for help, M.

Aucun commentaire:

Enregistrer un commentaire