Franklin T. Adams-Watters wrote:
In a programming context, non-transitively can happen by accident in an object-oriented language, if one creates two classes that know how to compare themselves to a third, but not to each other. E.g., Rational, Float, and Integer; 2/1 = 2, 2.0 = 2, but 2/1 != 2.0.
...and Ray Tayek responded:
yes, but that works by overloading ==.
But Ray, your original question was based on comparing floating-point numbers using |a-b|<epsilon, which is itself redefining the equality operator! The "real" equality operation on floating-point values is one that requires perfect matching, which is flawed in the opposite direction: too *few* things are equal, not too many. (When the "true" answer to some computation is not perfectly representable by your favorite floating-point scheme, two mathematically equivalent but computationally distinct evaluation techniques might result in non-identical answers. For instance, C tells me that (1/10)^2 != 1/100.) The problem here isn't with equality, it's with the associative and distributive laws for the arithmetic operations that generated the numbers in the first place. --Michael Kleber -- It is very dark and after 2000. If you continue you are likely to be eaten by a bleen.