This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
bug in %F
- From: James Antill <james at and dot org>
- To: libc-alpha at sources dot redhat dot com
- Date: 08 Mar 2002 12:30:31 -0500
- Subject: bug in %F
I submitted a bug a few months ago now, using glibcbug about %F being
broken in glibc ... having a look at current CVS it doesn't appear to
have been fixed. Are glibcbug reports getting lost ? Is it better to
just post them here ?
Anyway this program demonstrates the bug...
#define _GNU_SOURCE 1
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("%f\n", 4444.88888888);
printf("%F\n", 4444.88888888);
printf("%10.10f\n", 4444.88888888);
printf("%10.10F\n", 4444.88888888);
printf("%4.4f\n", 4444.88888888);
printf("%4.4F\n", 4444.88888888);
printf("%2.f\n", 4444.88888888);
printf("%2.F\n", 4444.88888888);
exit (EXIT_SUCCESS);
}
...%f and %F should only differ in the case of infinity etc. I'm
pretty sure the following patch fixes it (but it's untested)...
--- stdio-common/printf_fp.c-orig Fri Mar 8 11:49:03 2002
+++ stdio-common/printf_fp.c Fri Mar 8 11:53:29 2002
@@ -806,7 +806,7 @@
dig_max = INT_MAX; /* Unlimited. */
significant = 1; /* Does not matter here. */
}
- else if (info->spec == 'f')
+ else if (_tolower (info->spec) == 'f')
{
type = 'f';
fracdig_min = fracdig_max = info->prec < 0 ? 6 : info->prec;
...more info. was in my original report but I can't access the
database to get it out.
--
# James Antill -- james@and.org
:0:
* ^From: .*james@and\.org
/dev/null