Take a float absolute value using fabs() instead of abs(). Replace integer abs() by floating point fabs() in the approximate equality check for float values.