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.
#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;
}
.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
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers