Re: Proposal: Trigonometric functions in degrees

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dean Rasheed <dean(dot)a(dot)rasheed(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-31 12:23:38
Message-ID: CAB7nPqQuPbqPu74QbZ9ohn207sJqbR92yZzbeuzVo74KExqQYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jan 31, 2016 at 9:01 PM, Piotr Stefaniak
<postgres(at)piotr-stefaniak(dot)me> wrote:
> - result = sign * cosd_q1(arg1) / sind_q1(arg1);
> + result = sign * ((cosd_q1(arg1) / sind_q1(arg1)) / cot_45);
>
> and
>
> - result = sign * sind_q1(arg1) / cosd_q1(arg1);
> + result = sign * ((sind_q1(arg1) / cosd_q1(arg1)) / tan_45);
>
> both introduce division by zero, don't they?

Per IEEE 754, division by 0 for a double results in Nan or +/-Inf, so
that's actually correct.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2016-01-31 12:25:20 Re: PATCH: track last known XLOG segment in control file
Previous Message Alvaro Herrera 2016-01-31 12:18:36 Re: New gist vacuum.