This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/31006] long double constant is read as double in i386



------- Comment #3 from chat95 at mac dot com  2007-03-01 08:06 -------
1. 
//      long double PI * PI + IP 
        ld_a = ld_b = PI;
part becomes:
        movl    $560513024, %eax
        movl    $-921707870, %edx
        movl    $16384, %ecx
This number is equivalent to:
0x4000c90fdaa22168c000 
and we can write down as floating point number as:
2^(16384-16383) * 1.100100100001111 1101101010100010 0010000101101000
11000000000000 (B)

2.//      double PI * PI + IP
        d_a = d_b = PI;
part becomes:
        movl    $1413754136, %eax
        movl    $1074340347, %edx
this number is equivalent to:
0x400921fb54442d18,
and corresponding floating number is:
 2^(1024-1023)* 1.1001001000011111101101010100010001000010110100011000(B)
.

when we compare these significants of these two numbers:
1.100100100001111 1101101010100010 0010000101101000 11000(B)
1.100100100001111 1101101010100010 0010000101101000 11000 000000000 (B)

so - what we can say from here is:
#define PI 3.14...L is read as double for long double number with 0 filled 
lowest 16bits.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31006


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]