1. About BC
BC is an arbitrary precision calculator language, usually under Linux as a calculator, easy to use. Equivalent to a calculator under Windows.
2. Supported operators
Basic Mathematical Operations: + addition-Subtraction * Multiplication/division ^ exponent% remainder
expressions, logical operations, and mathematical functions are also supported.
3. Use
Enter BC under Linux
Then enter the operation, press ENTER to output the result of the operation
2+573*4127-252^386%513/40
In the example above, 3/4 is the 0.BC default output is an integer, to display the decimal point, set by Scale=number, number is the digit after the decimal point.
scale=33/4.750
You can enter more than one operation at a time, separated by semicolons, and returned once by pressing ENTER.
2+5;3*4;3*100712300
Numerical comparison
3 > 403 > 21
Logical Expressions
(3> 2) | | (1 < 2) 1 (3> 2) && (1 > 2) 0
Enter quit to exit
3. Through the pipeline
BC supports incoming parameter mode. Use the pipeline below to try it out.
$ echo "3+4" | Bc7
semicolon; separate input multiple
$ echo "3/4;SCALE=3;3/4" | BC 0.750
Address: http://blog.csdn.net/yonggang7/article/details/37317571