shithub: kwa

Download patch

ref: b8837029c5565f5ee91fabf205f740a380f4c972
parent: 1ffa8bd8f32394b7c972bf6d15d27007d22cf33c
author: qwx <qwx@sciops.net>
date: Sun Oct 26 19:30:13 EDT 2025

t.fmt: improve usefulness

--- a/test/t.fmt
+++ b/test/t.fmt
@@ -1,30 +1,32 @@
 {
 	for(x=1; x<=NF; x++){
-		OFMT = CONVFMT = "%.6g"
-		a = $x / 3
-		b = $x / 3 "_"
-		c = a "_"
-		s = a " " b " " c
-		OFMT="[%.1f]"
-		d = $x / 3
-		e = $x / 3 "_"
-		f = d "_"
-		s = s " " d " " e " " f
-		CONVFMT="(%.2f)"
-		g = $x / 3
-		h = $x / 3 "_"
-		i = g "_"
-		s = s " " g " " h " " i
-		OFMT="{%.1g}"
-		a = $x / 3
-		b = $x / 3 "_"
-		c = a "_"
-		s = s " " a " " b " " c
-		CONVFMT="|%.2g|"
-		d = $x / 3
-		e = $x / 3 "_"
-		f = d "_"
-		s = s " " d " " e " " f
-		print s
+		i = 0
+		OFMT = CONVFMT = "%.6f"
+		a[i] = (0+$x)  / 3.14
+		a[i+1] = ((0+$x)  / 3.14) "_"
+		a[i+2] = a[i] "_"
+		i += 3
+		OFMT = "[%.3f]"
+		a[i] = (0+$x)  / 3.14
+		a[i+1] = ((0+$x)  / 3.14) "_"
+		a[i+2] = a[i] "_"
+		i += 3
+		CONVFMT = "(%.3f)"
+		a[i] = (0+$x)  / 3.14
+		a[i+1] = ((0+$x)  / 3.14) "_"
+		a[i+2] = a[i] "_"
+		i += 3
+		OFMT = "{%.10g}"
+		a[i] = (0+$x)  / 3.14
+		a[i+1] = ((0+$x)  / 3.14) "_"
+		a[i+2] = a[i] "_"
+		i += 3
+		CONVFMT = "|%.10g|"
+		a[i] = (0+$x) / 3.14
+		a[i+1] = ((0+$x)  / 3.14) "_"
+		a[i+2] = a[i] "_"
+		i += 3
+		print a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]
+		delete a
 	}
 }
--