Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1asLl7-0002Ef-3n for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Apr 2016 02:51:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1asLl6-0007O0-2p for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Apr 2016 02:51:24 +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_2) (envelope-from ) id 1asLjj-0005lv-6L for pgsql-hackers@postgresql.org; Tue, 19 Apr 2016 02:49:59 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1asLjf-0005VX-NI for pgsql-hackers@postgresql.org; Tue, 19 Apr 2016 02:49:58 +0000 Received: by mail-pa0-x22d.google.com with SMTP id r5so1391764pag.1 for ; Mon, 18 Apr 2016 19:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XHiznTO9QaAbun4vNvysivPvpDzBcUwTDlvxMcL7h6o=; b=StLcoo9//NOVRcdoanfOZ+Hdb6g0PWyFr/dCI21U7tOl4kmYMp1YmFnlIhl2N9FqOE Xt1H4Bsu9bToKIiQzlCEOq9hi2xeVOCpq1oydNGsWZ3kbI7D7PQBZ6eC0oTG7dlE0+Go her5mc+oP22RO9XjFTp3j+EW4Hig80zCe1Qig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XHiznTO9QaAbun4vNvysivPvpDzBcUwTDlvxMcL7h6o=; b=hWHlK5xMPCQFA5F28kLNJ1Zj0Xxh/+z1RDgt/SzoL3+arSnIFlIcXq41S8Hz4LIW5o v9Qy5pVbV5QNFfq83a2NRVPFTK/6twN2LvKy8CRlnMPrVO6h2binjjdQ/ad6EEnKOUHD b4QHVpkqH8W9oyPvDWLb1ac1x4pny3eWwOmxZPt1PBILBoFBhqsDeTx+wlKKsJb18CHx sUWQ+eF3ov3c5iWFNPGukI/KO4Bz41YC86w97oPrv0YE5LovuJAXq+46j4wfNIqJU13h uaGIC8SDf8NEII7hauYwO2X6myScTNPaDqlS3CXAe5iJe21XSGzRF+VaNxv3+BMAJErY jsIw== X-Gm-Message-State: AOPr4FXOkr+rgn3TqQ6HWrU4DJU6SrmxrTANH3sREhElMpmXWVIk27TOfBNsofYEaXw2Uw== X-Received: by 10.66.65.169 with SMTP id y9mr763343pas.102.1461034193767; Mon, 18 Apr 2016 19:49:53 -0700 (PDT) Received: from tornado.leadboat.com (c-98-248-47-228.hsd1.ca.comcast.net. [98.248.47.228]) by smtp.gmail.com with ESMTPSA id w20sm86679301pfi.31.2016.04.18.19.49.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 18 Apr 2016 19:49:52 -0700 (PDT) Date: Mon, 18 Apr 2016 22:49:50 -0400 From: Noah Misch To: Tom Lane Cc: Michael Paquier , Peter Eisentraut , Robert Haas , Dean Rasheed , "pgsql-hackers@postgresql.org" Subject: Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees. Message-ID: <20160419024950.GB1983345@tornado.leadboat.com> References: <570311F1.6020902@gmx.net> <31479.1460152130@sss.pgh.pa.us> <5714552B.5030001@gmx.net> <12238.1460985466@sss.pgh.pa.us> <20160419021144.GA1984253@tornado.leadboat.com> <20830.1461032579@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20830.1461032579@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) X-Pg-Spam-Score: -2.7 (--) 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 On Mon, Apr 18, 2016 at 10:22:59PM -0400, Tom Lane wrote: > Noah Misch writes: > > On Mon, Apr 18, 2016 at 09:17:46AM -0400, Tom Lane wrote: > >> Given that it's apparently showing the results of asind as NULL ... > > > I doubt asind is returning NULL. Here's the query, which uses a CASE to > > report NULL if asind returns any value not on a whitelist: > > > SELECT x, > > CASE WHEN asind(x) IN (-90,-30,0,30,90) THEN asind(x) END AS asind, > > CASE WHEN acosd(x) IN (0,60,90,120,180) THEN acosd(x) END AS acosd, > > CASE WHEN atand(x) IN (-45,0,45) THEN atand(x) END AS atand > > FROM (VALUES (-1), (-0.5), (0), (0.5), (1)) AS t(x); > > Oh, duh --- should have checked the query. Yes, the most probable theory > must be that it's returning something that's slightly off from the exact > value. > > > I can see the benefit for atand(-0.5) and for atand(0.5), since those are > > inexact. Does the CASE gain us anything for asind or acosd? > > None of these are expected to be inexact. The point of the CASE is to > make it obvious if what's returned isn't *exactly* what we expect. Ah, got it. > We could alternatively set extra_float_digits to its max value and hope > that off-by-one-in-the-last-place values would get printed as something > visibly different from the exact result. I'm not sure I want to trust > that that works reliably; but maybe it would be worth printing the > result both ways, just to provide additional info when there's a failure. We'd have an independent problem if extra_float_digits=3 prints the same digits for distinguishable float values, so I wouldn't mind relying on it not to do that. But can we expect the extra_float_digits=3 representation of those particular values to be the same for every implementation? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers