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

From Tom Lane
Subject Re: Proposal: Trigonometric functions in degrees
Date
Msg-id 11878.1453495831@sss.pgh.pa.us
Whole thread Raw
In response to Re: Proposal: Trigonometric functions in degrees  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: Proposal: Trigonometric functions in degrees  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> I tried using feclearexcept + fetestexcept as recommended by
> POSIX.1-2008, and that does indeed make the above examples compliant
> on my linux box. Unfortunately it introduces new errors -- asin starts
> generating FE_UNDERFLOW errors for numbers that are really not that
> small, such as asin(1e-9), although the function still returns the
> correct answer. A bigger problem though is that these are C99
> functions and so won't necessarily be available on all supported
> platforms.

The latter issue could be dealt with via configure tests, but I agree that
if we get new error conditions we weren't exactly looking for, it would
not be a net improvement.  I think ensuring that the Inf and NaN cases are
platform-independent is already a good step forward, so we can stop there
for now.

> Attached are patches for this and the new functions in degrees, now
> with POSIX compatible Inf/NaN handling.

Pushed with minor, mostly cosmetic fixes.  I did renumber the function
OIDs to be closer to the original trig functions' numbers, using some
OIDs that were freed up by the recent index AM API change.
        regards, tom lane



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Combining Aggregates
Next
From: Simon Riggs
Date:
Subject: Re: Releasing in September