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 1jxfUP-00079d-8j for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jul 2020 23:46:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jxfUO-00009c-7F for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jul 2020 23:46:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxfUO-00009U-0L for pgsql-hackers@lists.postgresql.org; Mon, 20 Jul 2020 23:46:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxfUL-0000VF-Vm for pgsql-hackers@lists.postgresql.org; Mon, 20 Jul 2020 23:46:31 +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 06KNkOOA767349; Mon, 20 Jul 2020 19:46:25 -0400 From: Tom Lane To: Dean Rasheed cc: PostgreSQL Hackers , Andres Freund Subject: Re: NaN divided by zero should yield NaN In-reply-to: References: <3421746.1594927785@sss.pgh.pa.us> Comments: In-reply-to Dean Rasheed message dated "Fri, 17 Jul 2020 19:08:53 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <767347.1595288784.1@sss.pgh.pa.us> Date: Mon, 20 Jul 2020 19:46:24 -0400 Message-ID: <767348.1595288784@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Dean Rasheed writes: > On Thu, 16 Jul 2020 at 20:29, Tom Lane wrote: >> One thing that's not very clear to me is which of these spellings >> is preferable: >> if (unlikely(val2 == 0.0) && !isnan(val1)) >> if (unlikely(val2 == 0.0 && !isnan(val1))) > My guess is that the first would be better, since it would tell the > compiler that it's unlikely to need to do the NaN test, Yeah, that's the straightforward way to think about it, but I've found that gcc is sometimes less than straightforward ;-). Still, there's no obvious reason to do it the second way, so I pushed the first way. regards, tom lane