bug-gplusplus
[Top][All Lists]
Advanced

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

printf for type long double


From: Ben Horner
Subject: printf for type long double
Date: Wed, 8 May 2002 12:30:36 -0500

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);
}

This works with microsoft's compiler... though lots of other things 
don't.  Is this a bug?  Maybe it's something like printf is not designed
to work with long double?  I can use cout << d; but it doesn't give me 
the precision I need to test my stuff...  Any information about this 
problem, or any stabs at a work around/solution would be greatly 
appreciated.
-Ben



reply via email to

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