dc is a reverse-polish desk calculator which supports unlimited preci‐
sion arithmetic. It also allows you to define and call macros. Nor‐
mally 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 num‐
ber 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 new‐
lines. These have no meaning as commands.
$dc
1234
f
1234
2322
f
2322
1234
p * 2
2322
f
2
2865348
f
2
2865348
2 * p
4
f
4
2865348
p * 1
4
p
1
p
1
f
1
11461392
dc:
dc: stack empty
f
$

### Like this:

Like Loading...

*Related*