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

From Tom Lane
Subject Re: pgsql: Add support for hyperbolic functions, as well as log10().
Date
Msg-id 17820.1552514192@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Add support for hyperbolic functions, as well as log10().  (Michael Paquier <michael@paquier.xyz>)
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
Michael Paquier <michael@paquier.xyz> writes:
> On Tue, Mar 12, 2019 at 11:16:42PM -0400, Tom Lane wrote:
>> I'm inclined to leave it as-is for a day or so and see if any
>> other failures turn up, before deciding what to do about it.

> Fine by me.

Well, so far jacana is the only critter that's shown any problem.

I don't find any of the possible solutions to be super attractive:

1. Put in an explicit special case, along the lines of

    if (arg1 == 0.0)
        result = arg1;    /* Handle 0 and -0 explicitly */
    else
        result = asinh(arg1);

Aside from being ugly, this'd mean that our regression tests weren't
really exercising the library asinh function at all.

2. Drop that test case entirely, again leaving us with no coverage
of the asinh function.

3. Switch to some other test value besides 0.  This is also kinda ugly
because we almost certainly won't get identical results everywhere.
However, we could probably make the results pretty portable by using
extra_float_digits to suppress the low-order digit or two.  (If we did
that, I'd be inclined to do similarly for the other hyperbolic functions,
just so we're testing cases that actually show different results, and
thereby proving we didn't fat-finger which function we're calling.)

4. Carry an additional expected-results file.

5. Write our own asinh implementation.  Dean already did the work, of
course, but I think this'd be way overkill just because one platform
did their roundoff handling sloppily.  We're not in the business
of implementing transcendental functions better than libm does it.


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 ...

            regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] Block level parallel vacuum
Next
From: Thomas Munro
Date:
Subject: Re: Using condition variables to wait for checkpoints