Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1auWiu-00054V-DL for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Apr 2016 02:58:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1auWit-0000Zv-OX for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Apr 2016 02:58:07 +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 1auWhY-0007Tq-DW for pgsql-hackers@postgresql.org; Mon, 25 Apr 2016 02:56:44 +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_2) (envelope-from ) id 1auWhV-0005ig-3z for pgsql-hackers@postgresql.org; Mon, 25 Apr 2016 02:56:43 +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 u3P2uWYP007285; Sun, 24 Apr 2016 22:56:32 -0400 From: Tom Lane To: Peter Eisentraut cc: Dean Rasheed , Noah Misch , Michael Paquier , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees. In-reply-to: <571D8415.3050109@gmx.net> 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> <20160419024950.GB1983345@tornado.leadboat.com> <32425.1461038215@sss.pgh.pa.us> <20160419041631.GC1983345@tornado.leadboat.com> <18241.1461073100@sss.pgh.pa.us> <12182.1461098908@sss.pgh.pa.us> <57192E3C.9040109@gmx.net> <9748.1461284311@sss.pgh.pa.us> <571D8415.3050109@gmx.net> Comments: In-reply-to Peter Eisentraut message dated "Sun, 24 Apr 2016 22:42:29 -0400" Date: Sun, 24 Apr 2016 22:56:32 -0400 Message-ID: <7284.1461552992@sss.pgh.pa.us> X-Pg-Spam-Score: -2.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 Peter Eisentraut writes: > On 04/21/2016 08:18 PM, Tom Lane wrote: >> Could you send along the assembler code generated by the compiler (-S >> output) for float.c? Maybe that would shed some light. Probably the >> -O0 version would be easier to read. > Attached is a smaller test program that prints 29.9999999999999964 (same > as failing test result) as well as its assembler code. This doesn't prove much. It's clear from the assembly code that the compiler is evaluating "asin(0.5)" at compile time (and, presumably, getting a different answer than would be produced at runtime). But that's entirely unsurprising given this source text: you've got a naked application of asin() to a constant. What we need to know, and what this doesn't quite prove, is whether the compiler is managing to see through the tricks that float.c uses to prevent compile-time calculation of that value. The fact that this produces the same number as we see in the regression test does point to the idea that that's what's happening. But it's not conclusive. Part of the reason I'm not sold is that even if the compiler can see through those tricks when optimizing, it hardly seems like it should do so at -O0. If that is the answer, then the next question is how we can put more roadblocks in the way of compile-time evaluation of asin(0.5). Dean suggested that creative use of "volatile" might do it, and I agree that that sounds like a promising thing to pursue. 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