Re: [HACKERS] Floating point comparison inconsistencies of thegeometric types - Mailing list pgsql-hackers
From | Emre Hasegeli |
---|---|
Subject | Re: [HACKERS] Floating point comparison inconsistencies of thegeometric types |
Date | |
Msg-id | CAE2gYzwfHHFJm+Qs5YNvYQadpP7M3x-+0wXK0t-ZhZYzP1BPdQ@mail.gmail.com Whole thread Raw |
In response to | Re: [HACKERS] Floating point comparison inconsistencies of thegeometric types (Robert Haas <robertmhaas@gmail.com>) |
Responses |
Re: [HACKERS] Floating point comparison inconsistencies of thegeometric types
|
List | pgsql-hackers |
> Backing up a bit here, have we lost track of the problem that we're > trying to solve? Tom gave his opinion here: > > https://www.postgresql.org/message-id/3895.1464791274@sss.pgh.pa.us > > But I don't see that the latest patch I can find does anything to fix > that. This is what he wrote: > As I understand it, the key problem is that tests like "is point on line" > would basically never succeed except in the most trivial cases, because of > roundoff error. That's not very nice, and it might cascade to larger > problems like object-containment tests failing unexpectedly. We would > need to go through all the geometric operations and figure out where that > kind of gotcha is significant and what we can do about it. Seems like a > fair amount of work :-(. If somebody's willing to do that kind of > investigation, then sure, but I don't think just blindly removing these > macros is going to lead to anything good. I re-implemented "is point on line" operator on my patch so that it would, at least, work on the most trivial cases. This is not very nice, but it is predictable. I have tried to prevent it cascade to larger problems like object-containment tests failing unexpectedly. I have gone through all of the geometric operations and re-implemented the ones with similar problems, too. It is no work at all compared to discussions we have to have :-). My initial idea was to keep the fuzzy behaviour for some operators like "is point on line", but the more I get into it the less value I see in doing so. The same family operators like "is point on line" is currently badly broken: > postgres=# select '(1,0)'::point ## '{1,2,0}'::line; > ?column? > ---------- > (2,2) > (1 row) This makes me wonder if anybody is ever using those operators. In the end, I don't care about those operators. They are unlikely to be supported by indexes. I can simplify my patch to leave them as they are. > Now maybe that's not the problem that Emre is trying to solve, > but then it is not very clear to me what problem he IS trying to > solve. And I think Kyotaro Horiguchi is trying to solve yet another > problem which is again different. So IMHO the first task here is to > agree on a clear statement of what we'd like to fix, and then, given a > patch, we can judge whether it's fixed. I listed the problems I am trying to solve in here: https://www.postgresql.org/message-id/CAE2gYzzNufOZqh4HO3Od8urzamNSeX-OXJxfNkRcU3ex9RD8jw%40mail.gmail.com > Maybe I'm being dumb here and it's clear to you guys what the issues > under discussion are. If so, apologies for that, but the thread has > gotten too theoretical for me and I can't figure out what the > top-level concern is any more. I believe we all agree these macros > are bad, but there seems to be no agreement that I can discern on what > would be better or why. We couldn't agree on how we should treat on floating point numbers. I think we should threat them just like the "float" datatype.
pgsql-hackers by date: