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

Why Long double data type is working strange in my C code?

$
0
0

I'm using Windows 10 and MinGW GCC compiler(not the mingw64 one), but when I try this code,This is my GCC version,

C:\Users\94768>gcc -vUsing built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exeTarget: mingw32Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nlsThread model: win32gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)

The code is,

 #include <stdio.h> void main() {    float a = 1.12345;    double b = 1.12345;    long double c = 1.12345;    printf("float value is is %f\n", a);    printf("double value is %lf\n", b);    printf("long double value is %Lf\n", c);}

I got this output which is not what I expected, I don't understand what's the issue here, I am an absolute beginner to C programming.

float value is 1.123450double value is 1.123450long double value is -0.000000 

Immensely appreciate your guidance!


Viewing all articles
Browse latest Browse all 22298

Latest Images

Trending Articles



Latest Images

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