git: 9front

Download patch

ref: fd172ae4738391e53520cfe64e5d616063929810
parent: 9bcb7ba01e8044d3e9efe10b968508d8119a4b32
author: ppatience0 <ppatience0@gmail.com>
date: Sun Mar 3 08:21:17 EST 2013

fltfmt: %.0g should print with one significant figure

--- a/sys/src/libc/fmt/fltfmt.c
+++ b/sys/src/libc/fmt/fltfmt.c
@@ -187,7 +187,7 @@
 	 * c3 digits of trailing '0'
 	 * c4 digits after '.'
 	 */
-	if(chr == 'g') /* Significant figures. */
+	if(chr == 'g' && prec > 0) /* Significant figures. */
 		prec--;
 	c1 = 0;
 	c2 = prec + 1;
--