cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Printing long double data
Printing long double data
Aug 13, 2015 at 9:56am UTC
Alpha001
(10)
How can i print long double data type in c..Here %llf or %Lf is not working in my code?
Aug 13, 2015 at 10:04am UTC
MiiNiPaa
(8886)
%Lf should work:
1
2
3
4
5
6
7
8
#include <stdio.h>
int
main() {
long
double
d = 1.23456789; printf(
"%Lf"
,d);
return
0; }
http://ideone.com/os9LGr
Aug 13, 2015 at 11:54am UTC
Alpha001
(10)
This Programme is showing this output to me....
-0.000000
Process returned 0 (0x0)
Press any key to continue.
Aug 13, 2015 at 12:04pm UTC
MiiNiPaa
(8886)
Which compiler do you use? I remember that Microsoft one lacked proper support for long doubles in standard library, so if you use that you might want to switch compilers or upgrade.
EDIT: If you use GCC:
http://stackoverflow.com/questions/7134547/gcc-printf-and-long-double-leads-to-wrong-output-c-type-conversion-messes-u
Upgrade your MinGW installation.
Last edited on
Aug 13, 2015 at 12:06pm UTC
Topic archived. No new replies allowed.