From 5c0854ae0fd0a905d1c8e0954e16da3a8da3a2d2 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 15 Dec 2017 17:12:48 -0500 Subject: [PATCH] Add examples with 'dc -f' and 'dc -e' --- pages/common/dc.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pages/common/dc.md b/pages/common/dc.md index 33c60e7844..cf6f47f8c0 100644 --- a/pages/common/dc.md +++ b/pages/common/dc.md @@ -6,14 +6,19 @@ `dc` -- Calculate 4 times 5 [4 5 *], subtract 17 [17 -], and [p]rint the output : +- Execute dc script in file: + +`dc -f {{file}}` + +- Calculate 4 times 5 [4 5 *], subtract 17 [17 -], and [p]rint the output (using echo): `echo "4 5 * 17 - p"| dc` -- Set number of decimal places to 10 [k 7], calculate 5 divided by -3 [5 _3 /] and [p]rint: +- Set number of decimal places to 10 [k 7], calculate 5 divided by -3 [5 _3 /] and [p]rint (using dc -e): -`echo "7 k 5 _3 / p" | dc` +`dc -e "7 k 5 _3 / p"` - To 100 decimal places [100 k], calculate the golden ratio, phi: sqrt(5) [5 v] plus 1 [1 +], divided by 2 [2 /], and [p]rint result: -`echo "100 k 5 v 1 + 2 / p" | dc` +`dc -e "100 k 5 v 1 + 2 / p"` +