Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees.

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees.
Date: 2016-04-19 02:11:44
Message-ID: 20160419021144.GA1984253@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Mon, Apr 18, 2016 at 09:17:46AM -0400, Tom Lane wrote:
> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> > On Mon, Apr 18, 2016 at 12:31 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> >> I don't know if it's worth tracking this as an open item and thus
> >> kind-of release blocker if no one else has the problem. But I
> >> definitely still have it. My initial suspicion was that this had
> >> something to do with a partial upgrade to gcc 6 (not yet released), in
> >> other words a messed up system. But I was able to reproduce it in a
> >> freshly installed chroot. It only happens with various versions of gcc,
> >> but not with clang. So I'm going to have to keep digging.
>
> > gcc is moving slowly but surely to have 6.0 in a released state btw:
> > https://gcc.gnu.org/ml/gcc/2016-04/msg00103.html
>
> Given that it's apparently showing the results of asind as NULL, the
> theory that comes to mind is some sort of optimization issue affecting
> the output tuple's null-flags. I have no idea why only this test would
> be affected, though. Anyway, a good way to test that theory would be
> to see if the -O level affects it.

I doubt asind is returning NULL. Here's the query, which uses a CASE to
report NULL if asind returns any value not on a whitelist:

SELECT x,
CASE WHEN asind(x) IN (-90,-30,0,30,90) THEN asind(x) END AS asind,
CASE WHEN acosd(x) IN (0,60,90,120,180) THEN acosd(x) END AS acosd,
CASE WHEN atand(x) IN (-45,0,45) THEN atand(x) END AS atand
FROM (VALUES (-1), (-0.5), (0), (0.5), (1)) AS t(x);

I can see the benefit for atand(-0.5) and for atand(0.5), since those are
inexact. Does the CASE gain us anything for asind or acosd?

Results under -O0 would be a helpful data point, nonetheless.

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-04-19 02:22:59 Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees.
Previous Message Tom Lane 2016-04-18 22:06:07 pgsql: Make partition-lock-release coding more transparent in BufferAll

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-04-19 02:22:59 Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees.
Previous Message Marc Cousin 2016-04-18 22:59:39 Re: Memory leak in GIN index build