Linux repositories inspector
GNU Project


GNU dc arbitrary precision reverse-polish calculator


GNU's bc (a numeric processing language) and dc (a calculator)


dc - an arbitrary precision calculator


dc [-V] [--version] [-h] [--help]
[-e scriptexpression] [--expression=scriptexpression]
[-f scriptfile] [--file=scriptfile]
[file ...]


dc is a reverse-polish desk calculator which supports unlimited precision arithmetic. It also allows you to define and call macros. Normally dc reads from the standard input; if any command arguments are given to it, they are filenames, and dc reads and executes the contents of the files before reading from standard input. All normal output is to standard output; all error output is to standard error.
A reverse-polish calculator stores numbers on a stack. Entering a number pushes it on the stack. Arithmetic operations pop arguments off the stack and push the results.
To enter a number in dc, type the digits (using upper case letters A through F as "digits" when working with input bases greater than ten), with an optional decimal point. Exponential notation is not supported. To enter a negative number, begin the number with ‘‘_’’. ‘‘-’’ cannot be used for this, as it is a binary operator for subtraction instead. To enter two numbers in succession, separate them with spaces or newlines. These have no meaning as commands.


dc may be invoked with the following command-line options:
Print out the version of dc that is being run and a copyright notice, then exit.
Print a usage message briefly summarizing these command-line options and the bug-reporting address, then exit.
-e script
Add the commands in script to the set of commands to be run while processing the input.
-f script-file
Add the commands contained in the file script-file to the set of commands to be run while processing the input.
If any command-line parameters remain after processing the above, these parameters are interpreted as the names of input files to be processed. A file name of - refers to the standard input stream. The standard input will processed if no script files or expressions are specified.

Email bug reports to .


⇧ Top