This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/47945] REAL(8) output conversion error on MinGW32


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]