11/3/71 DC (I)
NAME dc -- desk calculator
SYNOPSIS dc
DESCRIPTION dc is an arbitrary precision integer arithmetic
package. The overall structure of dc is a stack-
ing (reverse Polish) calculator. The following
constructions are recognized by the calculator:
number
The value of the number is pushed on the
stack. If the number starts with a zero, it
is taken to be octal, otherwise it is decimal.
+ - * / %
The top two values on the stack are added (+),
subtracted (-), multiplied (*), divided (/),
or remaindered (%). The two entries are
popped off of the stack; the result is pushed
on the stack in their place.
sx
The top of the stack is popped and stored into
a register named x, where x may be any charac-
ter.
lx
The value in register x is pushed on the
stack. The register x is not altered.
d
The top value on the stack is pushed on the
stack. Thus the top value is duplicated.
p
The top value on the stack is printed in deci-
mal. The top value remains unchanged.
f
All values on the stack are popped off and
printed in decimal.
r
All values on the stack are popped.
q
exit.
h
print brief synopsis of commands to dc.
new-line
space
ignored.
An example to calculate the monthly, weekly and
hourly rates for a $10,000/year salary.
10000
100* (now in cents)
dsa (non-destructive store)
12/ (pennies per month)
la52/ (pennies per week)
d10* (deci-pennies per week)
375/ (pennies per hour)
f (print all results)
(3) 512
(2) 19230
(1) 83333
FILES --
SEE ALSO --
DIAGNOSTICS ? (x) for unrecognized character x.
BUGS % doesn't work correctly.
OWNER ken