Re: pgsql: Add support for hyperbolic functions, as well as log10().
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>,
laetitia.avrot@gmail.com
Date: 2019-03-13T21:56:32Z
Lists: 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
Commits
-
Further adjust the tests for the hyperbolic functions.
- c43ecdee0fff 12.0 landed
-
Adjust the tests for the hyperbolic functions.
- c015f853bf59 12.0 landed
-
Rethink how to test the hyperbolic functions.
- c6f153dcfebc 12.0 landed
-
Add support for hyperbolic functions, as well as log10().
- f1d85aa98ee7 12.0 cited