From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1362019787.512ec5cbd4024@www.imp.polymtl.ca> Date: Wed, 27 Feb 2013 21:49:47 -0500 From: Paul Patience To: 9fans@9fans.net MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 User-Agent: Internet Messaging Program (IMP) 3.2.3 Content-Transfer-Encoding: quoted-printable Subject: [9fans] Bug in print(2) g verb Topicbox-Message-UUID: 20dfa77c-ead8-11e9-9d60-3106f5b1d025 I already sent this mail, but it seems that 9fans didn't receive it. The g verb in print(2) does not work properly. The precision flag (%.ng) is supposed to print n significant figures, but it prints n+1 significant figures. This change fixes this behaviour. diff -r d6b623d4cac0 sys/src/libc/fmt/fltfmt.c --- a/sys/src/libc/fmt/fltfmt.c Sat Feb 23 14:05:51 2013 +0100 +++ b/sys/src/libc/fmt/fltfmt.c Wed Feb 27 15:59:34 2013 -0500 @@ -187,6 +187,8 @@ * c3 digits of trailing '0' * c4 digits after '.' */ + if(chr =3D=3D 'g') /* Significant figures. */ + prec--; c1 =3D 0; c2 =3D prec + 1; c3 =3D 0;