Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2007-04-25 00:09:50 +0400
committerEric Blake <eblake@redhat.com>2007-04-25 00:09:50 +0400
commit5866c02352c6af65c871a59fee1ccca3c8bebb7b (patch)
tree4c7fde48afbec940610939e156191d74415dbc4c /newlib/libc/stdio
parent27e5e9ab052d525303f491b39d08eb1be060caae (diff)
* libc/stdio/vfprintf.c (_VFPRINTF_R): Don't zero pad on infinity
or NaN with %05f.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/vfprintf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index eec0b5378..f9c1ddf3f 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -879,7 +879,12 @@ reswitch: switch (ch) {
_fpvalue = GET_ARG (N, ap, double);
}
- /* do this before tricky precision changes */
+ /* do this before tricky precision changes
+
+ If the output is infinite or NaN, leading
+ zeros are not permitted. Otherwise, scanf
+ could not read what printf wrote.
+ */
if (isinf (_fpvalue)) {
if (_fpvalue < 0)
sign = '-';
@@ -888,6 +893,7 @@ reswitch: switch (ch) {
else
cp = "inf";
size = 3;
+ flags &= ~ZEROPAD;
break;
}
if (isnan (_fpvalue)) {
@@ -896,11 +902,12 @@ reswitch: switch (ch) {
else
cp = "nan";
size = 3;
+ flags &= ~ZEROPAD;
break;
}
#else /* !_NO_LONGDBL */
-
+
if (flags & LONGDBL) {
_fpvalue = GET_ARG (N, ap, _LONG_DOUBLE);
} else {
@@ -917,6 +924,7 @@ reswitch: switch (ch) {
else
cp = "inf";
size = 3;
+ flags &= ~ZEROPAD;
break;
}
if (tmp == 1) {
@@ -925,6 +933,7 @@ reswitch: switch (ch) {
else
cp = "nan";
size = 3;
+ flags &= ~ZEROPAD;
break;
}
#endif /* !_NO_LONGDBL */