bc Command Examples

An arbitrary precision calculator language. See also: dc, qalc. More information: https://manned.org/bc.

bc

bc --interactive --mathlib

echo '{{5 / 3}}' | bc

bc {{path/to/script.bc}}

echo 'scale = {{10}}; {{5 / 3}}' | bc

echo '{{s|c|a|l|e}}({{1}})' | bc --mathlib

echo "define factorial(n) { if (n <= 1) return 1; return n*factorial(n-1); }; factorial({{10}})" | bc