BC in Raspberry Pi OS 2024

BC is the "interactive algebraic language with arbitrary precision" From GNU. BC is needed for compiling some applications. BC was missing from Linux distributions including the Raspberry Pi OS. The latest Pi OS has BC installed. You can forget this page if you have the latest release of an up to date Linux distribution.


The bc package is used by some applications to handle large numbers and odd types of numbers. Back in 2022, when I was compiling several applications and device drivers across multiple distributions of Linux, the bc package was needed in every Linux. People who use only precompiled applications will never need the bc package.


In Raspberry Pi OS from 2024, you get the following package included by default. I presume one of the Pi OS applications needs bc so the OS maintainers included bc for everyone.

    Package: bc

   Version: 1.07.1-3

   Maintainer: Ryan Kavanagh <rak@debian.org>

   Architecture: arm64

   Description-en: GNU bc arbitrary precision calculator language

   GNU bc is an interactive algebraic language with arbitrary precision which follows the POSIX 1003.2 draft standard, with several extensions including multi-character variable names, an `else' statement and full Boolean expressions. GNU bc does not require the separate GNU dc program.

   Homepage: https://www.gnu.org/software/bc/


If bc is not supplied with the operating system, you would install it along with build-essential and other packages. You would use something like the following command.

sudo apt install build-essential bc


bc is a package for the Linux based operating systems. You can find the current version via a search in the Synaptic Package Manager for almost any Linux or the "Software Manager" for your OS or using the following command. The command will return hundreds of results as bc is in many package names and descriptions.

apt-cache search bc


Regular maths options in most programming languages are limited in size or precision. bc is not. Regular maths options in most programming languages require numbers in specific formats. bc handles other formats. When your code requires something unusual, bc may help. bc has no other use.

Before looking at bc to handle something unusual in a specific programming language, look at the options for that languages as the other options may be more efficient.


You will only use bc when requested by a programming language compiler. If you install a package that needs bc, the package installation should include all other required packages including bc. After installation, you might need to use a programming language specific include statement in your code.


Big numbers are always a problem. Many years ago, big financial deals and end of year reports in dollars were at the limit of straight decimal calculations in the most powerful corporate computers. Then the tax department demanded the same reports to the nearest cent. Programmers scrambled to change code to strange double calculations. I provided a macro function for the most common assembler language. In parallel, other programmers produced libraries of code to do similar things in other languages.

Eventually the mess was cleaned up in Linux through the development of the bc library and code presented in the bc package. The result made life easier and more consistent across many programming languages.

So what. I do not write code for the tax department! Ok, what about calculating the number of days our Earth suffered climate change. About the year 2000, the best estimate was 3.8 billion years ago as the start of climate change. A recent revision said it started 4.2 billion years ago. 4.2 billion years before the year 2000 was 4,200,000,024 years ago or 1.533000009×10¹² days ago. Try feeding that type of number into your climate modelling.

Cyanobacteria appeared about 2.7 billion years ago and removed most of the CO2 from our atmosphere, resulting in Earth freeing over several times. Look up "snowball Earth". We would still be in a permanent ice age without volcanoes spewing carbon dioxide into the air and black ash over the white heat reflecting snow. The invasion of plants was balanced by plant eating organisms about 0.8 billion years ago. All of these figures are big but an adult male has 36 trillion cells in their body. Try modelling human growth without handling big numbers.

The bc package removes a whole lot of limitations on calculations in a simple effective way that is low cost to programmers. The common development optimises the code to be relatively low cost during calculations. bc saves everyone time and money when handling big or weird numbers.