Re: Proposal: Trigonometric functions in degrees - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Proposal: Trigonometric functions in degrees
Date
Msg-id 67665.1454258498@sss.pgh.pa.us
Whole thread Raw
In response to Re: Proposal: Trigonometric functions in degrees  (Piotr Stefaniak <postgres@piotr-stefaniak.me>)
List pgsql-hackers
Piotr Stefaniak <postgres@piotr-stefaniak.me> writes:
> These changes from 65abaab547a5758b0d6d92df4af1663bb47d545f
> - 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?

Huh? cot_45 and tan_45 are fixed values that should be very close to 1.
Or were you complaining that the potential div by 0 existed beforehand?

It's possible that we should check for sind_q1(arg1) or cosd_q1(arg1)
being zero before we try the divide, and substitute get_float8_infinity()
instead.  But the regression tests exercise this case, and none of the
buildfarm members complained, so I'm a bit disinclined to add code for
that purpose.  If anyone does report regression test failure here, we can
revisit the issue then.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Fwd: Core dump with nested CREATE TEMP TABLE
Next
From: Tom Lane
Date:
Subject: Re: Fwd: Core dump with nested CREATE TEMP TABLE