Arbitrary-Precision Math With bc
Run a calculator that handles very large numbers and decimal precision.
Pipe an expression into bc, for example echo "scale=10; 4*a(1)" | bc -l.
01Command
Command
$ echo "scale=10; 4*a(1)" | bc -l02What it does
bc is a command-line calculator language that supports arbitrary precision, bases, variables and functions. The -l flag loads the math library, enabling a(), s() and l() so you can compute pi as 4*a(1). Set scale to control decimal places.
03Risk
!Warning: bc truncates toward zero rather than rounding, and by default scale is 0 so division yields integers.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- bc — arbitrary precision calculator languageEvidence: GNU bc manual documenting scale, base conversion and the -l math library.
Last verified: 2026-09-20 · Category: Developer
06Related solutions
Change where screenshots are saved on Mac
Point macOS screen captures at any folder you choose instead of the desktop.
Download a file from a URL on Mac with curl
Grab any file from the web straight into the current folder — no browser needed.
Find files larger than 500 MB on Mac
List the biggest files in your home folder that are eating disk space.