Re: Add error functions: erf() and erfc()

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add error functions: erf() and erfc()
Date: 2023-03-09 00:27:47
Message-ID: CAEZATCX8os75BdCNARewvrbf663HTTqwHKi+D32XzyfkDCoK7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 9 Mar 2023 at 00:13, Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>
> On Wed, Mar 08, 2023 at 11:29:12PM +0000, Dean Rasheed wrote:
> > On Wed, 8 Mar 2023 at 20:11, Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
> >> The man pages for these seem to indicate that underflow can occur. Do we
> >> need to check for that?
> >
> > No, I don't think so. The docs indicate that if an underflow occurs,
> > the correct result (after rounding) should be returned, so I think we
> > should just return that result (as we do for tanh(), for example).
>
> Makes sense.
>
> I'm also wondering about whether we need the isinf() checks. IIUC that
> should never happen, but maybe you added that "just in case."
>

I copied those from dtanh(), otherwise I probably wouldn't have
bothered. erf() is always in the range [-1, 1], just like tanh(), so
it should never overflow, but maybe it can happen in a broken
implementation.

Regards,
Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-03-09 00:30:02 Re: Add error functions: erf() and erfc()
Previous Message Andres Freund 2023-03-09 00:27:29 Re: Should vacuum process config file reload more often