Re: Proposal: Trigonometric functions in degrees

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: noah(at)leadboat(dot)com
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Trigonometric functions in degrees
Date: 2016-01-23 17:08:40
Message-ID: 28880.1453568920@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> So the early returns from the buildfarm aren't very good:
> * tern/sungazer isn't getting exactly 0.5 from sind(30).

> The tern/sungazer result implies that this:

> return (sin(x * (M_PI / 180.0)) / sin(30.0 * (M_PI / 180.0))) / 2.0;

> is not producing exactly 0.5, which means that the two sin() calls aren't
> producing identical results, which I suspect is best explained by the
> theory that the compiler is rearranging 30.0 * (M_PI / 180.0) into
> (30.0 * M_PI) / 180.0, and getting a slightly different number that way.

> I think we could fix that by replacing (M_PI / 180.0) by a hard-wired
> constant (computed to say 20 digits or so).

So I pushed that, and tern/sungazer are still failing. Noah, could you
trace through that and see exactly where it's going off the rails?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2016-01-23 19:07:00 Re: PoC: Partial sort
Previous Message Tom Lane 2016-01-23 15:39:20 Re: Removing Functionally Dependent GROUP BY Columns