Simple and Easy-to-use calculator bc in Linux

Source: Internet
Author: User
Tags mathematical functions

Simple and Easy-to-use calculator bc in Linux
1. About bc
Bc is an arbitrary precision calculator language. It is usually used as a calculator in linux and is easy to use. It is equivalent to a calculator in windows.
2. Supported Operators
Basic mathematical operations: + addition-subtraction * multiplication/division ^ exponent % Remainder
It also supports expressions, logical operations, and mathematical functions.
3. Use
Enter bc in linux

$ Bcbc 1.06 Copyright 1991-1994,199 7, 1998,200 0 Free Software Foundation, Inc. This is free software with absolutely no warranty. For details type 'warranty '.
Input the operation and press enter to output the operation result.
2 + 573*4127-252 ^ 386% 513/40
In the above example, 3/4 is 0. bc, and the default output is an integer. to display the decimal point, set it by scale = number. number is the number of digits after the decimal point.
Scale = 33/4. 750
You can enter multiple operations at a time, separated by semicolons (;), and return one operation after pressing enter.
2 + 5; 3x4; 3x100712300
Numerical Comparison
3> 403> 21
Logical expression
(3> 2) | (1 <2) 1 (3> 2) & (1> 2) 0

Enter quit to exit
3. MPS queue
Bc supports parameter input. Next, use the MPs queue.
$ Echo "3 + 4" | bc7
Semicolon; Separate multiple input
$ Echo "3/4; scale = 3; 3/4" | bc 0.750

Address: http://blog.csdn.net/yonggang7/article/details/37317571

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.