Re: Line intersection point is wrong - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Line intersection point is wrong
Date
Msg-id 3949.1466459910@sss.pgh.pa.us
Whole thread Raw
In response to Re: Line intersection point is wrong  (Emre Hasegeli <emre@hasegeli.com>)
Responses Re: Line intersection point is wrong  (Emre Hasegeli <emre@hasegeli.com>)
List pgsql-bugs
Emre Hasegeli <emre@hasegeli.com> writes:
>> After working out the algebra by hand, I think the attached is correct
>> (and it does pass the regression tests, yay).  I also made the
>> line_parallel and line_perp tests more symmetric and zero-divide-free.

> It looks better to me, though not completely symmetric:

> hasegeli=# select '{0.000001,1000,0}'::line ?|| '{0.00009,90000,0}'::line;
>  ?column?
> ----------
>  f
> (1 row)

> hasegeli=# select '{0.00009,90000,0}'::line ?|| '{0.000001,1000,0}'::line;
>  ?column?
> ----------
>  t
> (1 row)

Hmm, that's annoying, although of course the existing code has problems
of the same ilk:

regression=# select '{1000,0.000001,0}'::line ?|| '{90000,0.00009,0}'::line;
 ?column?
----------
 f
(1 row)

regression=# select '{90000,0.00009,0}'::line ?|| '{1000,0.000001,0}'::line;
 ?column?
----------
 t
(1 row)

Basically this comes down to the fuzziness of the FPzero/FPeq tests.

It might be possible to fix this particular problem by changing the FPzero
tests in line_parallel() to exact "== 0" tests; though we would likely
be well advised to still keep the main test as FPeq.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Emre Hasegeli
Date:
Subject: Re: Line intersection point is wrong
Next
From: Michael Paquier
Date:
Subject: Re: BUG #14204: COMPATIBILITY