|
From: Per W. <pw...@ia...> - 2005-11-12 13:08:49
|
I don't think that you can.
When using Dev-C++, your program will be linked against the M$ C run-time
libraries, and to my knowledge they don't support the long double type.
You have to typecast your variable to double before printing it - giving
up the extra range and precision.
When printing 64-bit integers, you have a similar problem.
Using gcc on a unix machine you can write:
printf("Number = %Lu\n",n);
Using gcc on Windows, you have to emit a 64-bit integer using:
printf("Number = %I64u\n",n);
/Per W
On Sat, 12 Nov 2005, James Maddison wrote:
> Can someone tell me how to use printf to display a long double type
> variable. I've tried code along the lines of:
>
> long double ld=1.0L;
> printf("%Lg", ld);
>
> but that displays "0" rather than "1". I've tried similar with all other
> combinations of modifier/type that
> I can think of.
|