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 == 'g') /* Significant figures. */
+               prec--;
        c1 = 0;
        c2 = prec + 1;
        c3 = 0;



Reply via email to