Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 499EF1179B3F for ; Wed, 6 Jun 2012 01:59:04 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sc8Kj-0008Or-TR for pgsql-bugs@postgresql.org; Wed, 06 Jun 2012 04:59:03 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q564wm3m006246; Wed, 6 Jun 2012 00:58:48 -0400 (EDT) From: Tom Lane To: jeremie.thomassey@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6675: Box overlap with infinity edge In-reply-to: References: Comments: In-reply-to jeremie.thomassey@gmail.com message dated "Tue, 05 Jun 2012 07:15:22 -0000" Date: Wed, 06 Jun 2012 00:58:48 -0400 Message-ID: <6245.1338958728@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/40 X-Sequence-Number: 33267 jeremie.thomassey@gmail.com writes: > I can't understand this result : > SELECT box '((1,1),(infinity, 1))' && box '((2, 1),(infinity, 1))'; > ?column? > --------- > f > Isn't it supposed to return true? The documentation doesn't really say > anything about infinite edge. The test for this involves FPge(box1->high.x, box2->high.x) where FPge is defined as #define FPge(A,B) ((B) - (A) <= EPSILON) When both high.x values are infinity, you have infinity minus infinity, which yields NaN in IEEE arithmetic, so the comparison to epsilon comes out false. In general I don't think we promise that geometric operations involving infinite endpoints will behave sanely. There are probably a boatload of corner cases besides this one that'd need to be fixed before we could consider that a supported case. regards, tom lane