Re: Proposal: Trigonometric functions in degrees

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: Proposal: Trigonometric functions in degrees
Дата
Msg-id CAEZATCXRWw9qnWFMrh-B+gbNuVNG3HKgpHgTY1kZ=OhdoGE1Wg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Proposal: Trigonometric functions in degrees  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Proposal: Trigonometric functions in degrees
Список pgsql-hackers
On 26 October 2015 at 19:45, Peter Eisentraut <peter_e@gmx.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Proposal: Trigonometric functions in degrees
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Proposal: Trigonometric functions in degrees