V1/man/man1/dc.1
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 stacking (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 character.
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 decimal. 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
11/3/71 DC (I)
hourly rates for a $10,000/year salary.
10000
100* (now in cents)
dsa (non--destructive store)
12/ (pennies per month)
1a52/ (pennies per week)
dl0* (deci--pennies per week)
375/ (pennies per hzur)
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