dc: add page (#1807)

coverage
Starbeamrainbowlabs 2017-12-18 10:44:34 +00:00 committed by GitHub
commit 4be9d1c8b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

23
pages/common/dc.md Normal file
View File

@ -0,0 +1,23 @@
# dc
> An arbitrary precision calculator. Uses reverse polish notation (RPN).
- Run calculator in interactive mode:
`dc`
- 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 7 [7 k], calculate 5 divided by -3 [5 _3 /] and [p]rint (using dc -e):
`dc -e "7 k 5 _3 / p"`
- Calculate the golden ratio, phi: Set number of decimal places to 100 [100 k], square root of 5 [5 v] plus 1 [1 +], divided by 2 [2 /], and [p]rint result:
`dc -e "100 k 5 v 1 + 2 / p"`