* libc/stdio/vfprintf.c (_VFPRINTF_R): Don't zero pad on infinity
or NaN with %05f.
This commit is contained in:
parent
27e5e9ab05
commit
5866c02352
|
@ -1,5 +1,8 @@
|
||||||
2007-04-24 Eric Blake <ebb9@byu.net>
|
2007-04-24 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
|
* libc/stdio/vfprintf.c (_VFPRINTF_R): Don't zero pad on infinity
|
||||||
|
or NaN with %05f.
|
||||||
|
|
||||||
* libc/stdio/vfprintf.c (_VFPRINTF_R): Avoid multibyte when not
|
* libc/stdio/vfprintf.c (_VFPRINTF_R): Avoid multibyte when not
|
||||||
_MB_CAPABLE.
|
_MB_CAPABLE.
|
||||||
|
|
||||||
|
|
|
@ -879,7 +879,12 @@ reswitch: switch (ch) {
|
||||||
_fpvalue = GET_ARG (N, ap, double);
|
_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 (isinf (_fpvalue)) {
|
||||||
if (_fpvalue < 0)
|
if (_fpvalue < 0)
|
||||||
sign = '-';
|
sign = '-';
|
||||||
|
@ -888,6 +893,7 @@ reswitch: switch (ch) {
|
||||||
else
|
else
|
||||||
cp = "inf";
|
cp = "inf";
|
||||||
size = 3;
|
size = 3;
|
||||||
|
flags &= ~ZEROPAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (isnan (_fpvalue)) {
|
if (isnan (_fpvalue)) {
|
||||||
|
@ -896,11 +902,12 @@ reswitch: switch (ch) {
|
||||||
else
|
else
|
||||||
cp = "nan";
|
cp = "nan";
|
||||||
size = 3;
|
size = 3;
|
||||||
|
flags &= ~ZEROPAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !_NO_LONGDBL */
|
#else /* !_NO_LONGDBL */
|
||||||
|
|
||||||
if (flags & LONGDBL) {
|
if (flags & LONGDBL) {
|
||||||
_fpvalue = GET_ARG (N, ap, _LONG_DOUBLE);
|
_fpvalue = GET_ARG (N, ap, _LONG_DOUBLE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -917,6 +924,7 @@ reswitch: switch (ch) {
|
||||||
else
|
else
|
||||||
cp = "inf";
|
cp = "inf";
|
||||||
size = 3;
|
size = 3;
|
||||||
|
flags &= ~ZEROPAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (tmp == 1) {
|
if (tmp == 1) {
|
||||||
|
@ -925,6 +933,7 @@ reswitch: switch (ch) {
|
||||||
else
|
else
|
||||||
cp = "nan";
|
cp = "nan";
|
||||||
size = 3;
|
size = 3;
|
||||||
|
flags &= ~ZEROPAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* !_NO_LONGDBL */
|
#endif /* !_NO_LONGDBL */
|
||||||
|
|
Loading…
Reference in New Issue