pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Adjust degree-based trig functions for more portability.
Date: Sat, 23 Jan 2016 16:26:44 +0000
Message-ID: <E1aN11Q-0000UP-5q@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Adjust degree-based trig functions for more portability.

The buildfarm isn't very happy with the results of commit e1bd684a34c11139.
To try to get the expected exact results everywhere:

* Replace M_PI / 180 subexpressions with a precomputed constant, so that
the compiler can't decide to rearrange that division with an adjacent
operation.  Hopefully this will fix failures to get exactly 0.5 from
sind(30) and cosd(60).

* Add scaling to ensure that tand(45) and cotd(45) give exactly 1; there
was nothing particularly guaranteeing that before.

* Replace minus zero by zero when tand() or cotd() would output that;
many machines did so for tand(180) and cotd(270), but not all.  We could
alternatively deem both results valid, but that doesn't seem likely to
be what users will want.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/73193d82d7c8d849774bf6952dfb4287e213c572

Modified Files
--------------
src/backend/utils/adt/float.c                      |   59 +++++++++++++++++---
.../expected/float8-exp-three-digits-win32.out     |    4 +-
src/test/regress/expected/float8-small-is-zero.out |    4 +-
.../regress/expected/float8-small-is-zero_1.out    |    4 +-
src/test/regress/expected/float8.out               |    4 +-
5 files changed, 60 insertions(+), 15 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1aN11Q-0000UP-5q@gemulon.postgresql.org>
Permalink:  ../E1aN11Q-0000UP-5q@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1aN11Q-0000UP-5q@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Adjust degree-based trig functions for more portability.
  In-Reply-To: <E1aN11Q-0000UP-5q@gemulon.postgresql.org>
  References: <E1aN11Q-0000UP-5q@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox