bc, for basic calculator
bc takes the following options from the command line:
- Print the usage and exit.
- Define the standard math library.
- Give warnings for extensions to POSIX
- Process exactly the POSIX
- Do not print the normal GNU
- Print the version number and copyright and quit.
Calculating pi to 10000 places
Calculate pi using the builtin arctangent function, a().
$ bc -lq scale=10000 4*a(1) # The atan of 1 is 45 degrees, which is pi/4 in radians. # This may take several minutes to calculate. The bc command supports the following features.
- Arithmetic operators
- Increment and decrement operators
- Assignment operators
- Comparision or Relational Operators
- Logical or Boolean operators
- Math Functions
- Conditional statements
- Iterative statements