floating point inconsistency

Cedric Roux cedric.roux@acri-st.fr
Tue Feb 16 13:30:00 GMT 2010


Christoph Groth wrote:
> Now the question remains whether this is a bug in gcc or not.

I doubt it.
----------------------------------------------------------
.text

.globl _start
_start:
        fldl    angle
        fcos
        fstpl   result
        mov     $4, %eax
        mov     $1, %ebx
        mov     $result, %ecx
        mov     $8, %edx
        int     $0x80
        movl    $1, %eax
        xorl    %ebx, %ebx
        int     $0x80

.data
.align 8
.globl angle
.globl result
angle:
.byte 0x3f, 0x73, 0x11, 0xf7, 0xa3, 0x38, 0xe3, 0x3f

result:
.byte 0, 0, 0, 0, 0, 0, 0, 0
----------------------------------------------------------
gives that:

on the AMD:
/users/cro> ./a.out |od -tx1
0000000 75 d8 82 70 13 66 ea 3f
0000010

on the intel:
/users/cro> ./a.out |od -tx1
0000000 76 d8 82 70 13 66 ea 3f
0000010

on my 32b computer, it's same result as intel 64b.
Maybe a rounding issue on the AMD?
(one should do the computation by hand or with some
soft mathematical library to get more precision and
see what the next bit is so to know for sure what
truncation has to be done...)



More information about the Gcc-help mailing list