mingw-64 80 bit precision for doubles works

sisyphus1@optusnet.com.au sisyphus1@optusnet.com.au
Wed Dec 17 22:43:00 GMT 2014


-----Original Message----- 
From: navin p

>  How can gcc/mingw-64 build x64 executables with double precision set to 
> 80 bits?

You'll need to define __USE_MINGW_ANSI_STDIO to 1 at the beginning.

/***************************/
#define __USE_MINGW_ANSI_STDIO 1
#include <stdio.h>

int main(void) {
  long double x = 1.18L;
  printf("%La\n%.18Lg\n", x, x);
  return 0;
}

/***************************/

Outputs (with both 32-bit and 64-bit mingw builds of gcc):

0x9.70a3d70a3d70a3dp-3
1.18

You can, of course, build with -D__USE_MINGW_ANSI_STDIO on the command line 
if you don't want to define the symbol in the script.

Cheers,
Rob 



More information about the Gcc-help mailing list