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 1phUzm-0006MF-Ni for pgsql-bugs@arkaria.postgresql.org; Wed, 29 Mar 2023 12:33:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1phUzl-000816-25 for pgsql-bugs@arkaria.postgresql.org; Wed, 29 Mar 2023 12:33:41 +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 1phUzk-00080w-QC for pgsql-bugs@lists.postgresql.org; Wed, 29 Mar 2023 12:33:40 +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 1phUzi-0006VA-Oy for pgsql-bugs@lists.postgresql.org; Wed, 29 Mar 2023 12:33:39 +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 32TCXbCK3807421; Wed, 29 Mar 2023 08:33:37 -0400 From: Tom Lane To: Mats Kindahl cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17876: Function width_bucket() for float8 input returns value out of range In-reply-to: References: <17876-61f280d1601f978d@postgresql.org> Comments: In-reply-to Mats Kindahl message dated "Wed, 29 Mar 2023 10:18:42 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3807419.1680093217.1@sss.pgh.pa.us> Date: Wed, 29 Mar 2023 08:33:37 -0400 Message-ID: <3807420.1680093217@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mats Kindahl writes: > Attached is a proposed fix for the issue. Hm. Aren't you replacing a risk of overflow with a risk of underflow? I'd be happier about doing this only if isinf(bound2 - bound1), or the reverse for the other path. (Seems like we shouldn't need to check the operand diff separately.) regards, tom lane