pgsql: Further adjust degree-based trig functions for more portability.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Further adjust degree-based trig functions for more portability.
Date: 2016-01-23 21:19:20
Message-ID: E1aN5aa-000544-4p@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Further adjust degree-based trig functions for more portability.

The last round didn't do it. Per Noah Misch, the problem on at least
some machines is that the compiler pre-evaluates trig functions having
constant arguments using code slightly different from what will be used
at runtime. Therefore, we must prevent the compiler from seeing constant
arguments to any of the libm trig functions used in this code.

The method used here might still fail if init_degree_constants() gets
inlined into the call sites. That probably won't happen given the large
number of call sites; but if it does, we could probably fix it by making
init_degree_constants() non-static. I'll avoid that till proven
necessary, though.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/65abaab547a5758b0d6d92df4af1663bb47d545f

Modified Files
--------------
src/backend/utils/adt/float.c | 134 +++++++++++++++++++++++++++--------------
1 file changed, 89 insertions(+), 45 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-01-23 23:12:58 pgsql: Still further adjust degree-based trig functions for more portab
Previous Message Tom Lane 2016-01-23 16:26:44 pgsql: Adjust degree-based trig functions for more portability.