Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

printf and long double

$
0
0

I am using the latest gcc with Netbeans on Windows. Why doesn't long double work? Is the printf specifier %lf wrong?

Code:

#include <stdio.h>int main(void){    float aboat = 32000.0;    double abet = 5.32e-5;    long double dip = 5.32e-5;    printf("%f can be written %e\n", aboat, aboat);    printf("%f can be written %e\n", abet, abet);    printf("%lf can be written %le\n", dip, dip);    return 0;}

Output:

32000.000000 can be written 3.200000e+0040.000053 can be written 5.320000e-005-1950228512509697500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000can be written 2.725000e+002Press [Enter] to close the terminal ...

Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>