INFIX is when the operations are embedded within the operators
12*2
POSTFIX is when the operators are listed down and then followed by operations.
12 2 *
So, now to use infix calculator type the command "bc"
bash-3.00$ bc
Nothing happend. Now type in what you need to calculate and the system gives you output
1*2
2
1*2+3
5
2+3*2
8
Ok, now how to get out of this? Its simple. "quit"
.
.
2+3*2
8
quit
bash-3.00$
Various powerful options with bc command:
Find square root?
bash-3.00$ bc
sqrt(16)
4
similarly use below:
Postfix calculator:
user command "dc"
bash-3.00$ dc
2
3
*
p
6
2 3 *
p
6
2 3 * 4 +
p
10
Use "p" to print the result of your calculation.
sqrt(n) Square root of n
% Remainder
^ To the power of (3^5 is 3 to the power of 5)
s(n) Sine(n)
c(n) Cosine(n)
e(n) Exponential(n)
l(n) Log(n)
No comments:
Post a Comment