print function
[calc.git] / calc.c
diff --git a/calc.c b/calc.c
index eee39fe0b54cc34dcd1fb13eab0f0d85d94ef08a..8081c804963290490c166fef5eb5cf1d1ef2425c 100644 (file)
--- a/calc.c
+++ b/calc.c
@@ -133,7 +133,6 @@ int main (int argc, char *argv[])
     }
 
     /* format */
-    char format[9] = "=> %..g\n";
     format[5] = '0' + precision;
 
     /* completion list*/
@@ -336,7 +335,10 @@ int main (int argc, char *argv[])
 // test: echo -e '1 }\n1 )\n1 , 2\n ' | calc.exe | grep -c error | xargs test 3 =
 // test: echo -e 'si\t\t (pi / 2)' | calc.exe | grep -q '=> 1'
 
+// Gauss sequence
+// test: echo -e '{sto (1, 0), sto (10, 0), while (inc (10) < 100, {sto (1, rcl (1) + rcl (10)), print (rcl (1))})}' | calc.exe | grep -q '=> 5050'
+
 // Fibonacci sequence
-// test:  echo -e '{sto (1, 1), sto (2, 1), sto (10, 1), while (inc (10) < 12 - 1, {sto (3, rcl (1) + rcl (2)), sto (1, rcl (2)), sto (2, rcl (3))})}' | calc.exe | grep '=> 144'
+// test: echo -e '{sto (1, 1), sto (2, 1), sto (10, 1), while (inc (10) < 12 - 1, {sto (3, rcl (1) + rcl (2)), sto (1, rcl (2)), print (sto (2, rcl (3)))})}' | calc.exe | grep '=> 144'
 
 /* vim: set ts=4 sw=4 et: */