Re: pgsql: Add support for hyperbolic functions, as well as log10().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, laetitia(dot)avrot(at)gmail(dot)com
Subject: Re: pgsql: Add support for hyperbolic functions, as well as log10().
Date: 2019-03-13 21:56:32
Message-ID: 17820.1552514192@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Michael Paquier <michael(at)paquier(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2019-03-13 22:05:25 Re: Using condition variables to wait for checkpoints
Previous Message Robert Haas 2019-03-13 21:41:36 Re: [HACKERS] Block level parallel vacuum

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2019-03-13 22:02:43 pgsql: Use condition variables to wait for checkpoints.
Previous Message Robert Haas 2019-03-13 17:21:05 pgsql: Revert setting client_min_messages to 'debug1' in new tests.