[Update] The results would still be the same no matter I use lf
, Lf
, llf
...I am using Code Blocks to compile and run my C program. I am using GNU GCC compiler.
I tried to printf long double float type on different computers including two Windows and one Mac but it turns out that none of them is working as I expected. The code is the following:
#include <stdio.h>
#include <stdlib.h>
int main()
{
double d = 6.232345235; //8 bytes
long double ld = 5.5767458458;
printf("%lf\n", ld);
return 0;
}
Either the return value is -0.000000 or another very huge negative number which I don't remember now.
Any help is greatly appreciated! :D