pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Proposal: Trigonometric functions in degrees
Date: Mon, 30 Nov 2015 09:11:20 -0500
Message-ID: <31706.1448892680@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB7nPqRk+nNpJZ=AD8pG3305Bq9XwPrqEw4GUJhOk0XJ174W3w@mail.gmail.com>
References: <CAEZATCXxdzxb2Mvi0-Xvp43tfvw-bUi703HdAJuLUd7dt5-ZgQ@mail.gmail.com>
	<562E82F7.2060704@gmx.net>
	<CAEZATCXRWw9qnWFMrh-B+gbNuVNG3HKgpHgTY1kZ=OhdoGE1Wg@mail.gmail.com>
	<1671.1445890789@sss.pgh.pa.us>
	<CAEZATCXr7yioJHRXjgnu6f2W=tH5zuPtGmvxV0eT3WPgGKpSQg@mail.gmail.com>
	<5178.1445899865@sss.pgh.pa.us>
	<CAEZATCVZS+ccaEXNA-5qE=spk11Vtyxg8ePG_0RqpS1sjE==SA@mail.gmail.com>
	<CAEZATCV+6r0B1KG9KBFDY7K-9OyeAd5=UfwvR0YhGJgRJgWSOw@mail.gmail.com>
	<CAB7nPqS+wg+iWeL7pC1MS3ELmf4==XjJewH9_HPk+jx4NQ1E-g@mail.gmail.com>
	<CAB7nPqQ+KEtNXKUBNEzpOj4AESC8ipB3gUpgdbOb+b3KRgqzCw@mail.gmail.com>
	<CAEZATCW=tjGftAW44UcwpO419T83ZvdPC5vKH59WmDAA=7XjMw@mail.gmail.com>
	<CAEZATCUyVFyu2MFLk2uM28VQH2DmE=ryCuj8weBvyDOVe=8O2w@mail.gmail.com>
	<CAB7nPqQdichAyq3iNo_Ym9jgo6XkyuhivTV5tCG3E9Z_drCo6A@mail.gmail.com>
	<CAB7nPqRk+nNpJZ=AD8pG3305Bq9XwPrqEw4GUJhOk0XJ174W3w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Michael Paquier <michael.paquier@gmail.com> writes:
> On Mon, Nov 30, 2015 at 10:36 PM, Michael Paquier wrote:
>> Instinctively, it seems to me that we had better return Nan for the
>> new asind and acosd when being out of range for OSX, Linux will
>> complain about an out-of-range error so the code is right in this
>> case.

> This is still mentioned upthread btw. And it does not seem to be a
> good idea to change this platform dependent behavior by throwing an
> error on the old functions, neither does it seem user-friendly to have
> inconsistent results for the XXX function and its XXXd equivalent.

FWIW, I think that probably the best course of action is to go ahead
and install POSIX-compliant error checking in the existing functions
too.  POSIX:2008 is quite clear about this:

: An application wishing to check for error situations should set errno to
: zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
: functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
: FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
: occurred.

Although I'm not too sure about Windows, the inconsistent results
we're getting on OS X are certainly from failure to adhere to the spec.

I concur with Peter's opinion that this is material for a separate
patch, but it seems like it's one that had better go in first.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (57+ messages)  latest in thread

Message-ID: <31706.1448892680@sss.pgh.pa.us>
Permalink:  ../31706.1448892680@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31706.1448892680@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael.paquier@gmail.com, dean.a.rasheed@gmail.com, peter_e@gmx.net
  Subject: Re: Proposal: Trigonometric functions in degrees
  In-Reply-To: <31706.1448892680@sss.pgh.pa.us>
  References: <CAEZATCXxdzxb2Mvi0-Xvp43tfvw-bUi703HdAJuLUd7dt5-ZgQ@mail.gmail.com> <562E82F7.2060704@gmx.net> <CAEZATCXRWw9qnWFMrh-B+gbNuVNG3HKgpHgTY1kZ=OhdoGE1Wg@mail.gmail.com> <1671.1445890789@sss.pgh.pa.us> <CAEZATCXr7yioJHRXjgnu6f2W=tH5zuPtGmvxV0eT3WPgGKpSQg@mail.gmail.com> <5178.1445899865@sss.pgh.pa.us> <CAEZATCVZS+ccaEXNA-5qE=spk11Vtyxg8ePG_0RqpS1sjE==SA@mail.gmail.com> <CAEZATCV+6r0B1KG9KBFDY7K-9OyeAd5=UfwvR0YhGJgRJgWSOw@mail.gmail.com> <CAB7nPqS+wg+iWeL7pC1MS3ELmf4==XjJewH9_HPk+jx4NQ1E-g@mail.gmail.com> <CAB7nPqQ+KEtNXKUBNEzpOj4AESC8ipB3gUpgdbOb+b3KRgqzCw@mail.gmail.com> <CAEZATCW=tjGftAW44UcwpO419T83ZvdPC5vKH59WmDAA=7XjMw@mail.gmail.com> <CAEZATCUyVFyu2MFLk2uM28VQH2DmE=ryCuj8weBvyDOVe=8O2w@mail.gmail.com> <CAB7nPqQdichAyq3iNo_Ym9jgo6XkyuhivTV5tCG3E9Z_drCo6A@mail.gmail.com> <CAB7nPqRk+nNpJZ=AD8pG3305Bq9XwPrqEw4GUJhOk0XJ174W3w@mail.gmail.com> <31706.1448892680@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox