Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bEfRn-0000dH-CQ for pgsql-bugs@arkaria.postgresql.org; Sun, 19 Jun 2016 16:19:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bEfRm-0005K9-5E for pgsql-bugs@arkaria.postgresql.org; Sun, 19 Jun 2016 16:19:42 +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 1bEfR7-0004d6-Sb for pgsql-bugs@postgresql.org; Sun, 19 Jun 2016 16:19:02 +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 1bEfR4-0004Mj-Vl for pgsql-bugs@postgresql.org; Sun, 19 Jun 2016 16:19:00 +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 u5JGIvhp014751; Sun, 19 Jun 2016 12:18:57 -0400 From: Tom Lane To: emre@hasegeli.com cc: PostgreSQL Bugs Subject: Re: Line intersection point is wrong In-reply-to: References: Comments: In-reply-to Emre Hasegeli message dated "Sun, 19 Jun 2016 15:20:24 +0200" Date: Sun, 19 Jun 2016 12:18:57 -0400 Message-ID: <14750.1466353137@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: > While working on removing FP macros of the geometric type operators, > I noticed that line intersection is giving wrong results: Hm. I don't think I believe the vertical-line cases there either. They seem to be assuming A = -1 in a vertical line, which would be true if the line was computed by line_construct_pts, but otherwise not necessarily. regression=# select '((1,0),(1,1))'::line; line ---------- {-1,0,1} (1 row) regression=# select '{-1,0,1}'::line # '((0,2),(2,2))'::line; ?column? ---------- (1,2) -- this answer is correct (1 row) regression=# select '{-2,0,2}'::line # '((0,2),(2,2))'::line; ?column? ---------- (2,2) (1 row) If I haven't lost it completely, {-1,0,1} and {-2,0,2} are equivalent line values. line_eq certainly thinks so. Also: your formulation of the general case assumes that (l1->A * l2->B - l2->A * l1->B) is not zero, which I'm not entirely convinced of. In principle the line_parallel test would catch the case, but seeing that that is not exactly how line_parallel computes its result, roundoff error could bite us here. I wonder if line_interpt_internal should skip the line_parallel call and instead do its own tests for zero divide to detect parallel lines. 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