pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees.
Date: Sun, 24 Apr 2016 22:42:29 -0400
Message-ID: <571D8415.3050109@gmx.net> (raw)
In-Reply-To: <9748.1461284311@sss.pgh.pa.us>
References: <570311F1.6020902@gmx.net>
	<31479.1460152130@sss.pgh.pa.us>
	<CA+Tgmoa1fig2OV0Mam3dPmAOhaf6T_E8CXvQsDunvDV9vYEhwg@mail.gmail.com>
	<5714552B.5030001@gmx.net>
	<CAB7nPqSvocAX1n9Wbozo8nfdOAZaA0MAxvkpwSKTFjc-0NxadQ@mail.gmail.com>
	<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>
	<CAEZATCXxdf0ZG4Vbd-6ZrE8g-VYfFpGQpHBi1tFoi3S+TKn=VQ@mail.gmail.com>
	<18241.1461073100@sss.pgh.pa.us>
	<CAEZATCX-vpywtAFpkdir52Hqp-+xnM8Nwr7pU6XOCAeELDPuWA@mail.gmail.com>
	<12182.1461098908@sss.pgh.pa.us>
	<57192E3C.9040109@gmx.net>
	<9748.1461284311@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

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.

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

Attachments:

test.c (text/x-csrc, 231B) download #include <float.h> #include <math.h> #include <stdio.h> 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; }
test.s (text/plain, 1.2K) download .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

view thread (35+ messages)  latest in thread

Message-ID: <571D8415.3050109@gmx.net>
Permalink:  ../571D8415.3050109@gmx.net/
Also on:    postgresql.org/message-id/571D8415.3050109@gmx.net

 · 

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-committers@postgresql.org
  Cc: peter_e@gmx.net, tgl@sss.pgh.pa.us, dean.a.rasheed@gmail.com, noah@leadboat.com, michael.paquier@gmail.com, robertmhaas@gmail.com, 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> <CA+Tgmoa1fig2OV0Mam3dPmAOhaf6T_E8CXvQsDunvDV9vYEhwg@mail.gmail.com> <5714552B.5030001@gmx.net> <CAB7nPqSvocAX1n9Wbozo8nfdOAZaA0MAxvkpwSKTFjc-0NxadQ@mail.gmail.com> <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> <CAEZATCXxdf0ZG4Vbd-6ZrE8g-VYfFpGQpHBi1tFoi3S+TKn=VQ@mail.gmail.com> <18241.1461073100@sss.pgh.pa.us> <CAEZATCX-vpywtAFpkdir52Hqp-+xnM8Nwr7pU6XOCAeELDPuWA@mail.gmail.com> <12182.1461098908@sss.pgh.pa.us> <57192E3C.9040109@gmx.net> <9748.1461284311@sss.pgh.pa.us> <571D8415.3050109@gmx.net>

* 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