Re: pgsql: Add support for hyperbolic functions, as well as log10(). - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: pgsql: Add support for hyperbolic functions, as well as log10().
Date
Msg-id CAEZATCX-mFwmx0NKbGsYJ6RAo8Hb=c+_CeNNXWQ7-BmK2_XVWw@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Add support for hyperbolic functions, as well as log10().  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: Add support for hyperbolic functions, as well as log10().
Re: pgsql: Add support for hyperbolic functions, as well as log10().
List pgsql-hackers


On Wed, 13 Mar 2019, 21:56 Tom Lane, <tgl@sss.pgh.pa.us> wrote:

Of these, probably the least bad is #3, even though it might require
a few rounds of experimentation to find the best extra_float_digits
setting to use.  I'll go try it without any roundoff, just to see
what the raw results look like ...


Yeah, that seems like a reasonable thing to try.

I'm amazed that jacana's asinh() returned -0 for an input of +0. I'm not aware of any implementation that does that. I'd be quite interested to know what it returned for an input like 1e-20. If that returned any variety of zero, I'd say that it's worse than useless. Another interesting test case would be whether or not it satisfies asinh(-x) = -asinh(x) for a variety of different values of x, because that's something that commonly breaks down badly with naive implementations.

It's not unreasonable to expect these functions to be accurate to within the last 1 or 2 digits, so testing with extra_float_digits or whatever seems reasonable, but I think a wider variety of test inputs is required.

I also wonder if we should be doing what we do for the regular trig functions and explicitly handle special cases like Inf and NaN to ensure POSIX compatibility on all platforms.

Regards,
Dean


pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Offline enabling/disabling of data checksums
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Add support for hyperbolic functions, as well as log10().