X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX1+aFJszVTSahCJvaffnM3n1QCo+k57vK88TRAYwC7 9tqtTIIsGoYgl5 From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: _doprnt() bug fix Date: Fri, 14 Mar 2008 23:23:25 +0100 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200803142323.26022.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com 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.