bc

A calculator program with arbitrary precision that does the decimal maths bash itself cannot.

In more detail

Pipe an expression into it, as in echo "scale=2; 10 / 3" | bc, where scale sets the number of decimal places. bc -l loads a maths library and sets a default scale of 20.

Example

echo "scale=2; 10 / 3" | bc

Related terms

Taught in

References