bulia byak wrote:
On Sun, Aug 31, 2008 at 2:24 PM, Alvin Penner<penner@...1856...> wrote:
Investigation showed the following inequality throws the exception:
(136.653830 , -638.496893) == (136.653830 , -638.496893)
which in hex looks like:
(406114EC2CAB84D2 , C083F3F9A32A10A6) == (406114EC2CAB84D2 , C083F3F9A32A10A7)
would it not be desirable to (instead) put some tolerance for round-off error into the 2geom routine, since the difference between these two points is clearly negligible ?
I second that. It's never a good idea to test two floating point numbers for equality. You should always have an epsilon to account for rounding errors.
Yes, even though == works in a lot of cases, people should never trust it.
I noticed in point.h, == is overloaded like this:
inline bool operator==(Point const &a, Point const &b) { return (a[X] == b[X]) && (a[Y] == b[Y]); }
This should be "abs(a-b) < epsilon", however, maybe nathan has a faster way.