aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-05-02 20:53:48 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-05-03 19:29:04 -0700
commitd97c22df2daaeca6c2cec7f513babb667618f1f0 (patch)
tree736ca60214fe8745b4cb01e23921b1cc5e542479 /tests
parent3ad5c7c2890dca8e75bd116c17d7d9fe5c9ec608 (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/math.err0
-rw-r--r--tests/math.in9
-rw-r--r--tests/math.out8
-rw-r--r--tests/math.status1
4 files changed, 18 insertions, 0 deletions
diff --git a/tests/math.err b/tests/math.err
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/math.err
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