Date: Fri, 3 Nov 1995 01:10:02 -0800 From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs Subject: Re: bin/809: printf goroup bug [`.' optional precision] Message-ID: <199511030910.BAA00216@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/809; it has been noted by GNATS.
From: Bruce Evans <bde@zeta.org.au>
To: FreeBSD-gnats-submit@freebsd.org, kato@eclogite.eps.nagoya-u.ac.jp
Cc: Subject: Re: bin/809: printf goroup bug [`.' optional precision]
Date: Fri, 3 Nov 1995 20:02:56 +1100
>#include <stdio.h>
>void main(void)
>{
> printf("%.2d\n", 1);
> printf("%+.2d\n", 1);
> printf("%+.3d\n", 1);
>}
>gives following result:
>01
>+1
>+01
Signs and other prefixes reduce the precision in all cases that I looked at:
printf("%.3d\n", -1);
printf("%.3d\n", 1);
printf("%+.3d\n", -1);
printf("%+.3d\n", 1);
printf("% .3d\n", -1);
printf("% .3d\n", 1);
printf("%#.3x\n", 1);
gives the follow result:
-01
001
-01
+01
-01
01
0x1
Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511030910.BAA00216>
