Answers for "how to compare floats in c++"

1

compare float values c++

bool cmpf(float A, float B, float epsilon = 0.005f)
{ 
    return (fabs(A - B) < epsilon);
}
Posted by: Guest on May-19-2021

Browse Popular Code Answers by Language