Mail Archives: cygwin-developers/2000/08/16/07:33:40
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C00775.86A03BF0
Content-Type: text/plain;
charset="iso-8859-1"
I discovered this when testing the latest Perl:
main()
{
printf("%.0f\n", 0.1);
printf("%.0f\n", -0.1);
}
Produces:
0.
-0.
The trailing dot is the problem. Attached is a suggested
change that seems to fix the problem and not introduce any
others.
Regards,
Eric Fifer
------_=_NextPart_000_01C00775.86A03BF0
Content-Type: application/octet-stream;
name="printf.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="printf.patch"
=0A=
ChangeLog=0A=
=0A=
* libc/stdio/vfprintf.c (_vfprintf_r): suppress . with "%.0f", 0.1=0A=
=0A=
--- cygwin-1.1.4/newlib/libc/stdio/vfprintf.c.orig Tue Aug 15 17:37:29 =
2000=0A=
+++ cygwin-1.1.4/newlib/libc/stdio/vfprintf.c Wed Aug 16 10:15:54 =
2000=0A=
@@ -805,9 +805,11 @@=0A=
}=0A=
} else if (expt <=3D 0) {=0A=
PRINT("0", 1);=0A=
- PRINT(decimal_point, 1);=0A=
- PAD(-expt, zeroes);=0A=
- PRINT(cp, ndig);=0A=
+ if(ndig) {=0A=
+ PRINT(decimal_point, 1);=0A=
+ PAD(-expt, zeroes);=0A=
+ PRINT(cp, ndig);=0A=
+ }=0A=
} else if (expt >=3D ndig) {=0A=
PRINT(cp, ndig);=0A=
PAD(expt - ndig, zeroes);=0A=
------_=_NextPart_000_01C00775.86A03BF0--
- Raw text -