Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a3PCL-0004Jg-Fu for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2015 14:12:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a3PCK-00078v-L7 for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2015 14:12:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a3PB1-0005ej-26 for pgsql-hackers@postgresql.org; Mon, 30 Nov 2015 14:11:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a3PAy-0002lq-AO for pgsql-hackers@postgresql.org; Mon, 30 Nov 2015 14:11:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tAUEBK12031707; Mon, 30 Nov 2015 09:11:21 -0500 From: Tom Lane To: Michael Paquier cc: Dean Rasheed , Peter Eisentraut , PostgreSQL Hackers Subject: Re: Proposal: Trigonometric functions in degrees In-reply-to: References: <562E82F7.2060704@gmx.net> <1671.1445890789@sss.pgh.pa.us> <5178.1445899865@sss.pgh.pa.us> Comments: In-reply-to Michael Paquier message dated "Mon, 30 Nov 2015 22:39:58 +0900" Date: Mon, 30 Nov 2015 09:11:20 -0500 Message-ID: <31706.1448892680@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Michael Paquier 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