There seems to be many approaches to judge whether two floating-point numbers are identical. Here are some examples I've found:
fabs(x - y) < n * FLT_EPSILON * fabs(x)
ORfabs(x - y) < n * FLT_EPSILON * fabs(y)
fabs(x - y) < n * FLT_EPSILON * fabs(x + y)
fabs(x - y) < n * FLT_EPSILON * fabs(x + y) || fabs(x - y) < FLT_MIN)
fabs(x - y) / sqrt(x * x + y * y + FLT_EPSILON * FLT_EPSILON) < n * FLT_EPSILON
I'm really confused about them. Suppose there is a best way to compare two floating-point numbers, which is the fastest as well as the most accurate, the other approaches shouldn't even exist. So these different ways must have there own pros and cons.
My question is: Which approach is the fastest / most accurate / most practical?
Reference links:
http://accu.org/index.php/journals/1558 (1 and 4)
https://stackoverflow.com/a/10335601/5399734 (2 and 3)
Clarification: At least, I don't think "fastest / most accurate" is primarily opinion-based.