question on BASICally conversion

The author of that page does go on to suggest the following:

bool floatCompare(float f1, float f2) const
{
    static constexpr auto epsilon = 1.0e-05f;
    if (qAbs(f1 - f2) <= epsilon)
        return true;
    return qAbs(f1 - f2) <= epsilon * qMax(qAbs(f1), qAbs(f2));
}

In other words, scaling epsilon to the size of the numbers being compared. Seems decidedly better than what I’m doing now.

1 Like