summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorppatience0 <ppatience0@gmail.com>2013-02-27 16:15:18 -0500
committerppatience0 <ppatience0@gmail.com>2013-02-27 16:15:18 -0500
commit24ea306fa66c77739d4c35c892bdf1283f51bb33 (patch)
treeb8b076d350b945486abde31dca7b77c898313239
parent6b03a9495c6b67c691665821bc04633d326516cb (diff)
downloadplan9front-24ea306fa66c77739d4c35c892bdf1283f51bb33.tar.xz
fltfmt: %.ng is supposed to print a number with n significant figures, but it prints it with n+1. This fixes that behaviour.
-rw-r--r--sys/src/libc/fmt/fltfmt.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/src/libc/fmt/fltfmt.c b/sys/src/libc/fmt/fltfmt.c
index ff5462910..a00a6b14a 100644
--- a/sys/src/libc/fmt/fltfmt.c
+++ b/sys/src/libc/fmt/fltfmt.c
@@ -187,6 +187,8 @@ found:
* c3 digits of trailing '0'
* c4 digits after '.'
*/
+ if(chr == 'g') /* Significant figures. */
+ prec--;
c1 = 0;
c2 = prec + 1;
c3 = 0;