Re: Incompatible trig error handling

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: John Gorman <johngorman2(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Incompatible trig error handling
Date: 2015-06-13 05:09:00
Message-ID: 20150613050900.GA289675@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 29, 2015 at 05:11:48PM -0700, Tom Lane wrote:
> John Gorman <johngorman2(at)gmail(dot)com> writes:
> > Two of the trigonometry functions have differing error condition behavior
> > between Linux and OSX. The Linux behavior follows the standard set by the
> > other trig functions.
>
> We have never considered it part of Postgres' charter to try to hide
> platform-specific variations in floating-point behavior. If we did,
> we'd spend all our time doing that rather than more productive stuff.
>
> In particular, it appears to me that both of these behaviors are allowed
> per the POSIX standard, which makes it very questionable why we should
> insist that one is correct and the other is not.
>
> In addition, the proposed patch turns *all* cases that return NaN into
> errors, which is wrong at least for the case where the input is NaN.

OS X is a MATH_ERREXCEPT, !MATH_ERRNO platform. PostgreSQL wrongly assumes
that all platforms are MATH_ERRNO platforms. The correct fix is to use
fetestexcept() on !MATH_ERRNO platforms.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-06-13 08:47:59 Re: 9.5 release notes
Previous Message Peter Geoghegan 2015-06-13 04:10:17 Re: Time to fully remove heap_formtuple() and friends?