P
pereges
Let's say I have two doubles:
double a, b;
a = 9.35678910034592
b = 9.35678925602334
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.35678910034592
b = 9.35678925602334
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)
....