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/36200] [mingw] Wrong rounding in floating-point I/O



------- 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


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