bc

An arbitrary precision calculator language. See also: dc. More information: <https://manned.org/man/bc.1>.

Install

All systems
curl cmd.cat/bc.sh
Debian Debian
apt-get install bc
Ubuntu
apt-get install bc
Alpine
apk add bc
Arch Arch Linux
pacman -S bc
image/svg+xml Kali Linux
apt-get install bc
CentOS
yum install bc
Fedora
dnf install bc
Windows (WSL2)
sudo apt-get update sudo apt-get install bc
OS X
brew install bc
Raspbian
apt-get install bc
Docker
docker run cmd.cat/bc bc powered by Commando

An arbitrary precision calculator language. See also: dc. More information: <https://manned.org/man/bc.1>.

  • Start an interactive session:
    bc
  • Start an interactive session with the standard math library enabled:
    bc --mathlib
  • Calculate an expression:
    echo '5 / 3' | bc
  • Execute a script:
    bc path/to/script.bc
  • Calculate an expression with the specified scale:
    echo 'scale = 10; 5 / 3' | bc
  • Calculate a sine/cosine/arctangent/natural logarithm/exponential function using `mathlib`:
    echo 's|c|a|l|e(1)' | bc --mathlib

© tl;dr; authors and contributors