mardi 4 décembre 2018

IF Statements with negative numbers MATLAB

I'm trying to implement a simple if statement that checks the given value held in difference to a negative integer -2.5 within MATLAB R2018b.

For some reason this if statement does not check the values properly and lets in for example -1.824113696842179e+05 which is larger than -2.5

if difference > -2.5
        count = count + 1;
end

Any help with this problem would be much appreciated

Aucun commentaire:

Enregistrer un commentaire