Newbie Question about Long Double in Mingw

F

Fringe

I'm using Mingw 3.2 (Windows version of GCC) which supposedly supports 10bit
floating point numbers using Long Double. However, Long Doubles don't print
correctly even in a simple program like the following:

int main()
{
long double P = 1.123456789012345678901234L;
printf("%Lf\n", P);


system("PAUSE");
return 0;
}

Output: -0.000000

Do I need to write my own library functions in order to do operations on
Long Doubles in Mingw? Thanks
 
B

Ben Pfaff

Fringe said:
I'm using Mingw 3.2 (Windows version of GCC) which supposedly supports 10bit
floating point numbers using Long Double. However, Long Doubles don't print
correctly even in a simple program like the following:

Questions about compilers are best asked in newsgroups that
discuss those compilers.
 
C

CBFalconer

Fringe said:
I'm using Mingw 3.2 (Windows version of GCC) which supposedly supports 10bit
floating point numbers using Long Double. However, Long Doubles don't print
correctly even in a simple program like the following:

10 bit floating point seems pretty useless to me.
int main()
{
long double P = 1.123456789012345678901234L;
printf("%Lf\n", P);

system("PAUSE");
return 0;
}

Output: -0.000000

This might work better if it was a legal C program. #include
<stdio.h>, unload that silly system call, and specify the decimals
wanted in the printf call.

c:\c\junk>cat junk.c
#include <stdio.h>
int main(void)
{
long double P = 1.123456789012345678901234L;

printf("%.24Lf\n", P);
return 0;
}

c:\c\junk>.\a
1.123456789012345678887769
 
J

jacob navia

Mingw doesn't support long doubles since it uses CRTDLL.DLL.
That library doesn't support long doubles.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top