unittest {
    bool fuzzyCmp(float a, float b) {
        return abs(a-b) < 0.000001f;
    }
    float len1 = sqrt(8.0f);
    float len2 = sqrt(8.0f);
    assert(len1 == len2);              // passes
    assert(fuzzyCmp(len1,sqrt(8.0f))); // passes
    assert(len1 == sqrt(8.0f));        // fails!!
}


The comparison of the float variable passes, but the comparison to the return value of the sqrt-function fails.?!

Reply via email to