This is the mail archive of the gcc-help@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]

Q: Long double constant value


Hello all:
I don't seem to get correct output for long double constant value. I
am using EGCS (v1.1.2, MingW32) compiler version. Here is an example C
code:

#include <stdio.h>

int main(void)
   {
    long double val2 = 1.5;

    printf("Printing byte sizes for constant values: \n");
    printf("Double is %d\n", sizeof(12.345));
    printf("Long double is %d \n", sizeof(1.5L));

    printf("\nPrinting constant values: \n");
    printf("Long double: %Lf\n", 1.5L);
               // output is -2.000000
    printf("\nA double variable: %f\n", val1);
    printf("\nA long double variable: %Le\n", val2);
               // output is -2.000000e+000

    return 0;
   }

Thanks in advance for any help,

 -- Shiva KB


Sent via Deja.com http://www.deja.com/
Before you buy.


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