calc
Perform arithmetic calculations
TLDR
Start calc in interactive mode
Perform a calculation in non-interactive mode
Don't format the output (for use with [p]ipes)
Perform a calculation and then switch to [i]nteractive mode
Start calc in a specific permission [m]ode (0 to 7, defaults to 7)
View an introduction to calc
View an overview of calc
Open the calc manual
SYNOPSIS
calc [-d | -D | -e | -E | -h | -i | -r | -R] [-s prec] [-t tabstop] [file]
PARAMETERS
-d
Enable debugging mode
-D
Enable extended debugging mode
-e
End immediately after processing file
-E
Execute stdin as calc statements
-h
Display help message and exit
-i
Force interactive mode after file
-r
Recover from system crash (advanced)
-R
Use Reverse Polish Notation (RPN) mode
-s prec
Set default precision to prec digits
-t tabstop
Set tabstop width to tabstop columns
DESCRIPTION
Calc is a sophisticated command-line calculator designed for arbitrary precision arithmetic. It offers a C-like syntax for expressions, making it intuitive for programmers, while supporting variables, built-in functions (including trig, logs, and financial), conditionals, loops, and custom functions.
Users can perform simple calculations or write scripts for complex tasks. It emulates spreadsheet-like functionality with matrices and polynomials. Interactive mode allows immediate evaluation, and RPN mode caters to stack-based preferences.
Precision is user-configurable, ideal for scientific computing or big integers. Calc reads commands from files or stdin, with output formatting options. It's extensible via a Forth-like interpreter for advanced scripting. Widely used on Unix-like systems, it's lightweight yet powerful for math-heavy workflows.
CAVEATS
Not installed by default; requires calc package. Complex syntax may overwhelm beginners. High precision slows performance.
BASIC USAGE EXAMPLES
calc '2 + 3 * sin(PI/4)'
calc -s 50 -e 'print sqrt(2)'
echo 'x=5; print x^2' | calc -E
INTERACTIVE MODE
Run calc without args for prompt (>). Type expressions directly, use quit to exit. Supports ? for help.
HISTORY
Developed by Landon Curt Noll starting in 1986, with contributions from Jonathan Payne and others. Evolved from earlier Unix calculators; maintained for decades with precision and feature enhancements.


