Jump to content

Dc (computer program)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 147.72.234.5 (talk) at 20:31, 29 March 2004 (Dc is a reverse-polish desk calculator which supports unlimited precision arithmetic.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

From the GNU Project dc man page: 'Dc is a reverse-polish desk calculator which supports unlimited precision arithmetic'.

Unlike bc, it is based on Reverse-Polish Notation , which means it interprets mathematical statements in a stack based function.

For example to multiply four and five in dc:

4 5 *
p

This translated into 'push four and five onto the stack, then with the multiplication operator, pop the stack twice, multply them and push the result back on the stack.' Then by entering p, examine (print out to the screen) the first element on the stack.

To evaluate (3^4+12)/11-22:

3 4 ^ 12 + 11 / 22 -
p

See also RPN