pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: emre@hasegeli.com
Cc: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Subject: Re: Line intersection point is wrong
Date: Mon, 20 Jun 2016 17:58:30 -0400
Message-ID: <3949.1466459910@sss.pgh.pa.us> (raw)
In-Reply-To: <CAE2gYzy7Ne3DE7O2uBpsgbALBr_3CptsagEEu9n6p3JpYvRUdA@mail.gmail.com>
References: <CAE2gYzw_-z=V2kh8QqFjenu=8MJXzOP44wRW=AzzeamrmTT1=Q@mail.gmail.com>
	<14750.1466353137@sss.pgh.pa.us>
	<CAE2gYzyi_XkC4YdBj3E+a+7xYfOg0AR=sZsSCEWuYNFVmp+fCw@mail.gmail.com>
	<9953.1466360251@sss.pgh.pa.us>
	<CAE2gYzxrfOaje7D6vWJvs0FnmFE4MEEcfyb=O6EDzgzC64GzxA@mail.gmail.com>
	<18081.1466367402@sss.pgh.pa.us>
	<CAE2gYzzXG4BW7JoBhMFhgYoQxutkz-1CyDqMp5QPtXdE7BY2ww@mail.gmail.com>
	<19816.1466368944@sss.pgh.pa.us>
	<CAE2gYzy7Ne3DE7O2uBpsgbALBr_3CptsagEEu9n6p3JpYvRUdA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (13+ messages)  latest in thread

Message-ID: <3949.1466459910@sss.pgh.pa.us>
Permalink:  ../3949.1466459910@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3949.1466459910@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, emre@hasegeli.com
  Subject: Re: Line intersection point is wrong
  In-Reply-To: <3949.1466459910@sss.pgh.pa.us>
  References: <CAE2gYzw_-z=V2kh8QqFjenu=8MJXzOP44wRW=AzzeamrmTT1=Q@mail.gmail.com> <14750.1466353137@sss.pgh.pa.us> <CAE2gYzyi_XkC4YdBj3E+a+7xYfOg0AR=sZsSCEWuYNFVmp+fCw@mail.gmail.com> <9953.1466360251@sss.pgh.pa.us> <CAE2gYzxrfOaje7D6vWJvs0FnmFE4MEEcfyb=O6EDzgzC64GzxA@mail.gmail.com> <18081.1466367402@sss.pgh.pa.us> <CAE2gYzzXG4BW7JoBhMFhgYoQxutkz-1CyDqMp5QPtXdE7BY2ww@mail.gmail.com> <19816.1466368944@sss.pgh.pa.us> <CAE2gYzy7Ne3DE7O2uBpsgbALBr_3CptsagEEu9n6p3JpYvRUdA@mail.gmail.com> <3949.1466459910@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox