29 if (x == 0.0 && y == 0.0) {
33 if (fabs(x) > fabs(y)) {
34 return fabs((x - y) / x) < epsilon;
36 return fabs((x - y) / y) < epsilon;
42 if (x == 0.0 && y == 0.0){
45 if (fabs(x) > fabs(y)){
46 return fabs((x - y) / x) < epsilon;
48 return fabs((x - y) / y) < epsilon;
52 bool almostEqual(
long double x,
long double y,
long double epsilon)
54 if (x == 0.0 && y == 0.0){
57 if (std::fabs(x) > std::fabs(y)){
58 return std::fabs((x - y) / x) < epsilon;
60 return std::fabs((x - y) / y) < epsilon;
bool almostEqual(float x, float y, float epsilon)