Re: src/include/utils/float.h comment one link stable - Mailing list pgsql-hackers

From David Rowley
Subject Re: src/include/utils/float.h comment one link stable
Date
Msg-id CAApHDvpJ+=yVRbDcDMsrF1Wt=C7fD1SfmegMzi7JSo3QdCcyBA@mail.gmail.com
Whole thread Raw
In response to Re: src/include/utils/float.h comment one link stable  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: src/include/utils/float.h comment one link stable
List pgsql-hackers
On Tue, 7 Oct 2025 at 04:24, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> David Rowley <dgrowleyml@gmail.com> writes:
> > Going by the draft C11 standard in [3], on page 230 it looks like
> > INFINITY is always defined now, so maybe we can get rid of the other
> > code and just always "return (float4) INFINITY;"? I did try that with
> > VS2022 just to make sure and I don't get a warning.
>
> +1, let's give that a try.  However, INFINITY has been required since
> C99, so please don't change that comment.

I got a clean bill of health from CI [1] for this patch, so went ahead
and pushed it after putting the C99 comments back.

The VS2019 CI instance seems happy and free from any new warnings.

> I wonder if we couldn't also remove the NAN hacks in the same file.
> NAN's been required since C99 as well, and it's equally hard to
> believe that we still need to support compilers that don't conform.
>
> (Strictly speaking, NAN is required only if the underlying float
> implementation has it.  But we desupported non-IEEE float arithmetic
> years ago.)

I saw the "The macro NAN is defined if and only if the implementation
supports quiet NaNs for the float type." in the standard and that
causes me to stop at INFINITY. I'd be happy for someone else to
continue. I'm a bit hesitant due to the "#if defined(NAN) &&
!(defined(__NetBSD__) && defined(__mips__))", which are systems I have
little knowledge of.

David

[1] https://cirrus-ci.com/build/5341920676806656



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: make tsearch use the database default locale
Next
From: Tom Lane
Date:
Subject: Re: src/include/utils/float.h comment one link stable