Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aurNa-0005iB-Nc for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Apr 2016 01:01:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aurNZ-0000y4-Hx for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Apr 2016 01:01:29 +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 1auWTy-0004l4-Vb for pgsql-hackers@postgresql.org; Mon, 25 Apr 2016 02:42:43 +0000 Received: from mout.gmx.net ([212.227.17.22]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.84_2) (envelope-from ) id 1auWTr-0005Oh-FO for pgsql-hackers@postgresql.org; Mon, 25 Apr 2016 02:42:42 +0000 Received: from auth1-smtp.messagingengine.com ([66.111.4.227]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0Lg6op-1bW7cZ3n4N-00pbX2 for ; Mon, 25 Apr 2016 04:42:33 +0200 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailauth.nyi.internal (Postfix) with ESMTP id 1C8CC246AE for ; Sun, 24 Apr 2016 22:42:31 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Sun, 24 Apr 2016 22:42:31 -0400 X-Sasl-enc: 9ARdsRuyHR4u9WgYI9AnEVQjNmGBVOVMTjKBqh6mNDVP 1461552150 Received: from vanquo.pezone.net (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 99575680141; Sun, 24 Apr 2016 22:42:30 -0400 (EDT) Subject: Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees. To: Tom Lane 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> Cc: Dean Rasheed , Noah Misch , Michael Paquier , Robert Haas , "pgsql-hackers@postgresql.org" From: Peter Eisentraut Message-ID: <571D8415.3050109@gmx.net> Date: Sun, 24 Apr 2016 22:42:29 -0400 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <9748.1461284311@sss.pgh.pa.us> Content-Type: multipart/mixed; boundary="------------040508060206000103020000" X-Provags-ID: V03:K0:rJMjifW7ZYTw3hyso4G6xAVnm+8ZGTd5soi7aJsFaawK6u9JeQ8 +AS9L95xG0TETQimU/SXdQPI+fZPe6kVLl9axf7SbqQ9B7QCve6suZoYwjpyXqN/PQRwHJo DBVjj2U5e6PZTqjursu5DC4xCgKJ+6h6F4wIPAUQw3wtvkIWYgZnSo3QqDt90ahlsmuiXsQ IY4s5ZV5wbvTn39Y8+qHA== X-UI-Out-Filterresults: notjunk:1;V01:K0:craEY+69a/I=:9i6qpteczfSD8e98N1DR2h MjlwczhW45eeksdU9PnlJ2E2tHnPObJ+8EZLEdjXXtHgtEdKKKGLlbzbRC7VRyn0XcEctAwPR H3NKPpKMsQFZtqIL9aO3Dx1Fisw+RtsI1njuqCy7fvtgyniR7/tSB2XrEcnIWRq4JTJtHV74Z rUuO9NU+ruVQKDUvNZZthALEe6TBIbEw5DUiukiAOkJc310tzZ7fczpK5LgW8kRskwFFQ0lAS Lm5E0QoUTdbJsfS796kXZNHc91YsIqJDslcc0Cc/c8q97gn6z7nx1FcKPAar1pDrfg9Q2U2VX tk/MoJO6Rhh/dBEK3KmnhX1LJ9gxg/T88KGicVTUaEg5JB824VSfBqeqROw6/cxOgkk7fFdWS YOiTQt0cSdl0sWjAq5uvSuIoMw0TUExvPz9ziSPTp5zTvzFH6ytuXeOBtrh1CTUuc82yhya7a 61p/fX7jH4meA2/QTYR7n563ALQxxr7diyvExepuKEzeOWjr00mLZv8myDzNkxdTScljc5acn 7wsdra2hl6Ukp2c5IRKTvzINZTd5aEWreHIvUCW9v2Yfuu/1yLgYErdActjIbPkPmsLY3awOX AsVU0aOFantxgf89FIGlHbZLgq71H58TgdUWs8MVnwUKlmbdrdmeXwwKwSWd2ATbbxGucADVK zvmXwt9viHCgTAiHErbFFn6ZUCMkAvMpcqflme4tb5c3rVArcY50TTfeMopxQIintjPEtW/C/ a9v0jJSipwo30UJx5DIhLT/j7+lUXS/4okcUNayvIuPQEmXhlqT3TwHSY1E= X-Pg-Spam-Score: -3.6 (---) 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 This is a multi-part message in MIME format. --------------040508060206000103020000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 04/21/2016 08:18 PM, Tom Lane wrote: > Hm. This seems to prove that we're not getting exactly 1.0 from > (asin(x) / asin_0_5) with x = 0.5, but I'm having a hard time guessing > why that might be so when all the other cases work. > > 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. --------------040508060206000103020000 Content-Type: text/x-csrc; name="test.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test.c" #include #include #include static double sub() { double asin_0_5 = asin(0.5); double x = 0.5; return (asin(x) / asin_0_5) * 30.0; } int main() { printf("%.*g\n", DBL_DIG + 3, sub()); return 0; } --------------040508060206000103020000 Content-Type: text/plain; charset=UTF-8; name="test.s" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test.s" .file "test.c" .text .type sub, @function sub: .LFB0: .cfi_startproc pushl %ebp .cfi_def_cfa_offset 8 .cfi_offset 5, -8 movl %esp, %ebp .cfi_def_cfa_register 5 subl $24, %esp fldl .LC0 fstpl -16(%ebp) fldl .LC1 fstpl -24(%ebp) subl $8, %esp pushl -20(%ebp) pushl -24(%ebp) call asin addl $16, %esp fdivl -16(%ebp) fldl .LC2 fmulp %st, %st(1) leave .cfi_restore 5 .cfi_def_cfa 4, 4 ret .cfi_endproc .LFE0: .size sub, .-sub .section .rodata .LC4: .string "%.*g\n" .text .globl main .type main, @function main: .LFB1: .cfi_startproc leal 4(%esp), %ecx .cfi_def_cfa 1, 0 andl $-16, %esp pushl -4(%ecx) pushl %ebp .cfi_escape 0x10,0x5,0x2,0x75,0 movl %esp, %ebp pushl %ecx .cfi_escape 0xf,0x3,0x75,0x7c,0x6 subl $4, %esp call sub leal -8(%esp), %esp fstpl (%esp) pushl $18 pushl $.LC4 call printf addl $16, %esp movl $0, %eax movl -4(%ebp), %ecx .cfi_def_cfa 1, 0 leave .cfi_restore 5 leal -4(%ecx), %esp .cfi_def_cfa 4, 4 ret .cfi_endproc .LFE1: .size main, .-main .section .rodata .align 8 .LC0: .long 942502758 .long 1071694162 .align 8 .LC1: .long 0 .long 1071644672 .align 8 .LC2: .long 0 .long 1077805056 .ident "GCC: (Debian 5.3.1-13) 5.3.1 20160323" .section .note.GNU-stack,"",@progbits --------------040508060206000103020000 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------040508060206000103020000--