bc (Basic Calculator) is a command-line utility that provides all features you expect from a simple scientific or financial calculator. It is specifically useful for doing floating point math.
If bc command not installed, you can install it using:
Once installed, you can run it in interactive mode or non-interactively by passing arguments to it – we will look at both case. To run it interactively, type the command bc on command prompt and start doing some math, as shown.
The following examples show how to use bc non-interactively on the command-line.
-l flag is used to the default scale (digits after the decimal point) to 20, for example: