Dc
{{language |exec=interpreted |checking=dynamic |hopl id=1957 }} {{language programming paradigm|concatenative}} [[Category:Utility]]
[[wp:dc (computer program)|dc]] is the unix '''d'''esktop '''c'''alculator.
It uses a reverse polish notation and is turing complete.
;See also
- [[:Category:Bc|bc]] - '''b'''asic '''c'''alculator
== Quick reference ==
Commands in [[AT&T dc]]
number : push a number (0-9A-F digits, _ negative, . radix point)
[...] : push a string
+ - * / % ^ : arithmetic operations: add sub mul div mod pow
v : square root
c : clear stack
d : duplicate top of the stack
f : show stack
p : print value with a newline, leave it on the stack
P : print string, or print number as ASCII string
sx : store to register x
lx : load from register x
Sx : push to register x
Lx : pop register x
1 2 :x : store x[2] = 1 (x is register)
2 ;x : retrieve x[2]
Extensions in both [[GNU dc]] and [[OpenBSD dc]] a : print ASCII character n : print value without a newline ~ : divmod: division and remainder r : reverse (swap) the top two elements
: comment
Extension in [[GNU dc]] | : arithmetic - modular exponentiation
Extensions in [[OpenBSD dc]]
3 J : break 3 execution levels, then jump to next M
M : mark for the J command
R : pop and discard top of the stack