This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/47945] REAL(8) output conversion error on MinGW32
- From: "thenlich at users dot sourceforge.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 2 Mar 2011 13:49:19 +0000
- Subject: [Bug libfortran/47945] REAL(8) output conversion error on MinGW32
- Auto-submitted: auto-generated
- References: <bug-47945-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47945
--- Comment #9 from Thomas Henlich <thenlich at users dot sourceforge.net> 2011-03-02 13:49:15 UTC ---
It seems that MinGW has its own implementation of snprintf called
__mingw_snprintf which can be activated by defining __USE_MINGW_ANSI_STDIO
__mingw_snprintf has the desired behaviour:
#include <stdio.h>
main() {
double d = .14285714285714286;
char str[200];
__mingw_snprintf(str, sizeof(str), "MinGW: %35.32f", d);
puts(str);
_snprintf(str, sizeof(str), "MSVCRT: %35.32f", d);
puts(str);
return;
}
MinGW: 0.14285714285714284921269268124888
MSVCRT: 0.14285714285714285000000000000000
Is there a way to use this in Fortran too?