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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, 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-25 19:09:39
Message-ID: 12552.1461611379@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

I wrote:
> If that is the answer, then the next question is how we can put more
> roadblocks in the way of compile-time evaluation of asin(0.5). Dean
> suggested that creative use of "volatile" might do it, and I agree
> that that sounds like a promising thing to pursue.

It occurred to me that we don't actually need "volatile". What we need
is a variable that the compiler is not allowed to assume is a compile-time
constant, and a plain global variable is sufficient for that. In the
attached patch, we no longer need an assumption that init_degree_constants
doesn't get inlined; we only need to assume that the compiler can't prove
the variables degree_c_thirty etc to be immutable. Which it cannot, even
if it does global optimization across the whole PG executable, because it
has to consider that loadable extensions might change them.

I'm going to go ahead and push this, because it seems clearly more robust
than what we have. But I'd appreciate a report on whether it fixes your
issue.

regards, tom lane

Attachment Content-Type Size
degree-constants-one-more-time.patch text/x-diff 4.3 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2016-04-25 19:18:40 Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013
Previous Message Tom Lane 2016-04-25 16:28:55 pgsql: Try harder to detect a port conflict in PostgresNode.pm.

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2016-04-25 19:18:40 Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013
Previous Message Guo, Yun 2016-04-25 19:08:32 how to measure pglogical replication lag