How do you compare float and double while accounting for precision loss?
Be extremely careful using any of the other suggestions. It all depends on context. I have spent a long time tracing bugs in a system that presumed a==b if |a-b|<epsilon. The underlying problems were: The implicit presumption in an algorithm that if a==b and b==c then a==c. Using the same epsilon for lines measured in … Read more