This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/36200] [mingw] Wrong rounding in floating-point I/O
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 May 2008 11:00:35 -0000
- Subject: [Bug libfortran/36200] [mingw] Wrong rounding in floating-point I/O
- References: <bug-36200-10259@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from fxcoudert at gcc dot gnu dot org 2008-05-11 11:00 -------
This should be double-checked by someone who understand this weird printf
format better than me, but I think it's a __mingw_snprintf bug:
$ cat u.c
#include <stdio.h>
extern int __mingw_snprintf (char *, size_t, const char *, ...);
int main (void) {
char buf[100];
__mingw_snprintf (buf, 50, "%+-#31.*e\n", 0, 39.);
puts (buf);
snprintf (buf, 50, "%+-#31.*e\n", 0, 39.);
puts (buf);
return 0;
}
$ gcc u.c && a
+3.e+01
+4.e+001
The same printf on x86_64-linux gives: "+4.e+01", so it looks both native
Windows and mingw are wrong.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36200