Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jwnTq-00079t-5n for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Jul 2020 14:06:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jwnTp-0000ER-5U for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Jul 2020 14:06:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jwnTo-0000EK-Ui for pgsql-hackers@lists.postgresql.org; Sat, 18 Jul 2020 14:06:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jwnTl-0008Ce-1c for pgsql-hackers@lists.postgresql.org; Sat, 18 Jul 2020 14:06:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 06IE6DvG3941234; Sat, 18 Jul 2020 10:06:13 -0400 From: Tom Lane To: Dean Rasheed cc: PostgreSQL Hackers Subject: Re: Wrong results from in_range() tests with infinite offset In-reply-to: References: <3393130.1594925893@sss.pgh.pa.us> <3464257.1594936216@sss.pgh.pa.us> <3506768.1594947597@sss.pgh.pa.us> Comments: In-reply-to Dean Rasheed message dated "Sat, 18 Jul 2020 09:16:39 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3941232.1595081173.1@sss.pgh.pa.us> Date: Sat, 18 Jul 2020 10:06:13 -0400 Message-ID: <3941233.1595081173@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Dean Rasheed writes: > if (isinf(base) && isinf(offset)) > { > if ((base > 0 && sub) || (base < 0 && !sub)) > PG_RETURN_BOOL(true); > } Yeah, I'd experimented with more-or-less that logic before arriving at my v2 patch. I didn't like the outcome that "inf both infinitely precedes and infinitely follows itself". Still, it is nicely simple. To make sense of this behavior, you have to argue that +/-inf are not in any way concrete values, but represent some sort of infinite ranges; then there could be some members of the class "inf" that infinitely precede other members. I thought that was bending the mathematical concept a bit too far. However, this isn't an area of math that I've studied in any detail, so maybe it's a standard interpretation. Still, I think the results my v2 patch gets make more sense than these. regards, tom lane