From d97c22df2daaeca6c2cec7f513babb667618f1f0 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Mon, 2 May 2016 20:53:48 -0700 Subject: add floating point output to `math` command This makes it easy for the user to request floating point output with the desired number of digits after the decimal point (not to be confused with significant digits). Note that this is just a thin wrapper so someone can say `math -s3 10 / 3` rather than `math "scale=3; 10 /3"`. Resolves #1643 --- tests/math.err | 0 tests/math.in | 9 +++++++++ tests/math.out | 8 ++++++++ tests/math.status | 1 + 4 files changed, 18 insertions(+) create mode 100644 tests/math.err create mode 100644 tests/math.in create mode 100644 tests/math.out create mode 100644 tests/math.status (limited to 'tests') diff --git a/tests/math.err b/tests/math.err new file mode 100644 index 00000000..e69de29b diff --git a/tests/math.in b/tests/math.in new file mode 100644 index 00000000..d8cb5092 --- /dev/null +++ b/tests/math.in @@ -0,0 +1,9 @@ +math 3 / 2 +math 10/6 +math -s0 10 / 6 +math -s3 10/6 +math '10 % 6' +math -s0 '10 % 6' +math '23 % 7' +math -s6 '5 / 3 * 0.3' +true diff --git a/tests/math.out b/tests/math.out new file mode 100644 index 00000000..0a46b6a5 --- /dev/null +++ b/tests/math.out @@ -0,0 +1,8 @@ +1 +1 +1 +1.666 +4 +4 +2 +.499999 diff --git a/tests/math.status b/tests/math.status new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/math.status @@ -0,0 +1 @@ +0 -- cgit v1.2.3