Re: Proposal: Trigonometric functions in degrees

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Emre Hasegeli <emre(at)hasegeli(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Trigonometric functions in degrees
Date: 2015-10-26 14:18:32
Message-ID: 26314.1445869112@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> On 25 October 2015 at 09:16, Emre Hasegeli <emre(at)hasegeli(dot)com> wrote:
>> I would prefer gradian over degree.

> I think gradians are generally less commonly used than degrees and
> radians, so I'm less inclined to include them.

I agree. gradians are not often used at all, AFAICT.

> Having degree-based functions would make it trivial to implement
> user-defined gradian-based functions, just by multiplying or dividing
> by 0.9, and they would return exact results in the smaller number of
> cases where gradian results are exactly representable.

... but having said that, your argument here is faulty, because 0.9
in itself is not exactly representable in binary. You'd be relying
on roundoff happening in the right direction to get exact answers
from such calculations, for just the same reasons that sind() can't be
just "sin(x * scalefactor)" if you want exact-where-possible results.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thom Brown 2015-10-26 16:37:53 Re: Patch (2): Implement failover on libpq connect level.
Previous Message Masahiko Sawada 2015-10-26 14:06:26 Re: Freezing without cleanup lock