Your almostEqual function doesn't seem to work if neither a nor b is zero.

For example if a=1000000 and b=1000001 then their difference is greater than DELTA.

But your function calculates (a-b), which is one, divided by the greater of a and b. The result is 0.000000999 which is less than DELTA.

Is DELTA an absolute difference or a percentage/relative difference?

If it is absolute, the entire function can be this:

boolean almostEqual(float a, float b) {

const float DELTA = .00001; // max difference to be almost equal

return fabs(a - b) <= DELTA;

}

Pete