Linux comes with two commands that support basic mathematical computing. If you do not want to use commands, you can use python or other
Two commands are easy to remember. One is that dc is actually an expression evaluate stack operation, and the other is bc, which is actually an explanatory language and supports various while if operations.
1: The following common commands are supported:
+-*/% ^ | V (initiator)
It is also very convenient to use, for example, to calculate 1 + 1 =?
After entering the dc command, enter an expression factor in each line, for example, 1 +
4th p indicates that the number of operations on the stack is displayed. For example, here is 1 +.
Java code
$ Dc
1
1
+
P
2
The specific use can be man dc, and other register operations are also supported.
2: Next, let's take a look at the bc Command, which has powerful functions. Here we will directly reference an introductory article by someone else.
Linux calculator bc command
Http://www.heiqu.com/show-27997-1.html
The following is an example of the above 1 + 1,
Java code
$ Bc
1 + 2 + 3 + 4 + 5
15
In comparison, dc operations are more like evaluating the suffix expression on the computer stack, while bc is the general infix expression.
Author: "dikar cloud mozhu"