Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bF7Dv-0008Rs-Gc for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Jun 2016 21:59:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bF7Dv-00076a-20 for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Jun 2016 21:59:15 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bF7DH-0006NP-Eh for pgsql-bugs@postgresql.org; Mon, 20 Jun 2016 21:58:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bF7DE-0000Fu-Lv for pgsql-bugs@postgresql.org; Mon, 20 Jun 2016 21:58:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u5KLwUOq003950; Mon, 20 Jun 2016 17:58:30 -0400 From: Tom Lane To: emre@hasegeli.com cc: PostgreSQL Bugs Subject: Re: Line intersection point is wrong In-reply-to: References: <14750.1466353137@sss.pgh.pa.us> <9953.1466360251@sss.pgh.pa.us> <18081.1466367402@sss.pgh.pa.us> <19816.1466368944@sss.pgh.pa.us> Comments: In-reply-to Emre Hasegeli message dated "Mon, 20 Jun 2016 23:40:17 +0200" Date: Mon, 20 Jun 2016 17:58:30 -0400 Message-ID: <3949.1466459910@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Emre Hasegeli 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