bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf for type long double


From: Juergen Heinzl
Subject: Re: printf for type long double
Date: Wed, 8 May 2002 23:42:10 +0000 (UTC)
User-agent: slrn/0.9.7.4 (Linux)

In article <address@hidden>, Ben Horner wrote:
> Hello all,
> I'm trying to do some testing on a set of classes I have written...
> I recently switched to the gnu compiler from Visual C++'s compiler.
> For some reason printf is not working for the type long double.
> It just prints out gibberish, nothing to do with the variables I pass.
> Here is a code snippet that shows the problem:
> 
> #include "stdio.h"
> int main (int argc, char *argv[])
> {
>       long double d = 123456789.0123456789;
>       printf("%10.10f\n", d);
>       return(0);
> }
[-]
See man 3 printf() a. use %Lf. %f means double, not long double. It's
the standard.

Ta',
Juergen

-- 
\ Real name     : Juergen Heinzl       \       no flames      /
 \ EMail Private : address@hidden \ send money instead /



reply via email to

[Prev in Thread] Current Thread [Next in Thread]