Mail Archives: djgpp-workers/2008/03/14/17:22:01
The configure script of m4-1.4.10 tests certain printf behaviour issueing a
code line similar to this one:
printf("%010f", 1.0 / 0.0);
Linux produces and passes the test with this output:
" inf"
but current CVS version of _doprnt() produces this output:
"0000000Inf"
The following patch should fix the issue.
Regards,
Juan Manuel Guerrero
diff -aprNU3 djgpp.orig/src/libc/ansi/stdio/doprnt.c djgpp/src/libc/ansi/stdio/doprnt.c
--- djgpp.orig/src/libc/ansi/stdio/doprnt.c 2007-12-11 07:27:40 +0000
+++ djgpp/src/libc/ansi/stdio/doprnt.c 2008-03-14 23:02:34 +0000
@@ -246,6 +246,14 @@ _doprnt(const char *fmt0, va_list argp,
_ldouble = va_arg(argp, long double);
else
_ldouble = (long double)va_arg(argp, double);
+ if (flags & ZEROPAD)
+ {
+ _longdouble_union_t ip;
+
+ ip.ld = _ldouble;
+ if (ip.ldt.exponent == 0x7fff)
+ flags &= ~ZEROPAD;
+ }
/*
* don't do unrealistic precision; just pad it with
* zeroes later, so buffer size stays rational.
- Raw text -