Re: Proposal: Trigonometric functions in degrees

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Trigonometric functions in degrees
Date: 2015-10-26 20:02:27
Message-ID: CAEZATCXRWw9qnWFMrh-B+gbNuVNG3HKgpHgTY1kZ=OhdoGE1Wg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26 October 2015 at 19:45, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> On 10/24/15 5:24 AM, Dean Rasheed wrote:
>> Additionally, functions that worked natively in degrees would be able
>> to return exact answers in special cases like cosd(90) = 0, whereas
>> cos(radians(90)) is not exactly 0 because pi/2 cannot be represented
>> exactly as a floating point number.
>
> But how you are going to implement that? I don't see a sind() in the C
> library.
>

I'm thinking something along the lines of:

1. Reduce the range of the input (say to 0..90 degrees).
2. Handle special cases (0, 30 and 90 for sind()).
3. Otherwise convert to radians for the general case.

Regards,
Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-10-26 20:19:49 Re: Proposal: Trigonometric functions in degrees
Previous Message Peter Eisentraut 2015-10-26 19:45:59 Re: Proposal: Trigonometric functions in degrees