Let's say I have two doubles:
double a, b;
a = 9.3567891003459 2
b = 9.3567892560233 4
Obviously, a < b but lets say I just want to check up to 6 places
after the decimal. I want to check if the condition a >= b is
satisfied. I have a tolerance value:
#define EPSILON 0.000001
Is this a good way to check for a >= b
if( fabs(a-b) <= EPSILON)
....
double a, b;
a = 9.3567891003459 2
b = 9.3567892560233 4
Obviously, a < b but lets say I just want to check up to 6 places
after the decimal. I want to check if the condition a >= b is
satisfied. I have a tolerance value:
#define EPSILON 0.000001
Is this a good way to check for a >= b
if( fabs(a-b) <= EPSILON)
....
Comment