pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Subject: Re: NaN divided by zero should yield NaN
Date: Mon, 20 Jul 2020 19:46:24 -0400
Message-ID: <767348.1595288784@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEZATCX2-2doB6LTexN7LzAxQ6oSv2CbWZ=hCUqR-N2WN8n+zA@mail.gmail.com>
References: <3421746.1594927785@sss.pgh.pa.us>
	<CAEZATCX2-2doB6LTexN7LzAxQ6oSv2CbWZ=hCUqR-N2WN8n+zA@mail.gmail.com>

Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On Thu, 16 Jul 2020 at 20:29, Tom Lane <tgl@sss.pgh.pa.us> 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





view thread (3+ messages)

Message-ID: <767348.1595288784@sss.pgh.pa.us>
Permalink:  ../767348.1595288784@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/767348.1595288784@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dean.a.rasheed@gmail.com, pgsql-hackers@lists.postgresql.org, andres@anarazel.de
  Subject: Re: NaN divided by zero should yield NaN
  In-Reply-To: <767348.1595288784@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox