Category:Dc: Difference between revisions
Content added Content deleted
m (Lang template) |
(dc commands) |
||
Line 1: | Line 1: | ||
{{language}}dc is the unix desktop calculator. It uses a reverse polish notation and is turing complete. |
{{language}}dc is the unix desktop calculator. It uses a reverse polish notation and is turing complete. |
||
Commands in POSIX dc |
|||
number : push a number |
|||
+ - / * % ^ : arithmetic operations |
|||
sx Sx : pop the stack and save or push it to register x |
|||
lx Lx : copy | pop the register x to main stack. |
|||
d : duplicate top of the stack |
|||
p : print top of the stack |
|||
P : pop and print String |
|||
f : show stack |
|||
q : exit (drop execution stack by 2) |
|||
Q : drop execution stack by top of the stack number |
|||
x : execute dc commands on top of the stack |
|||
X : replace top of stack by its scale factor. |
|||
[...] : string notation |
|||
<x >x =x : compare 2 elements at top of the stack, and execute register x |
|||
v : square root |
|||
! : shell command |
|||
c : clear |
|||
i : set input radix from top of stack |
|||
I : push input base on the top of the stack. |
|||
o : set output radix from top of stack |
|||
O : push output base on the top of the stack. |
|||
k : set scale factor |
|||
K : get current scale factor |
|||
z : get the current stack level. |
|||
Z : get the character length of element at top of stack |
|||
? : read input and execute. |
|||
Y : debug information |
|||
a b ;r : store r[b] = a (r is register) |
|||
a ;r : retrieve r[b] |
|||
GNU Extensions |
|||
n : print value without a new line |
|||
| : arithmetic - modular exponentiation |
|||
r : swap the top two elements |
|||
a : asciify |
|||
!>r !<r !=r : execute contents of register x based on comparison |
|||
X : pushes the number of fractional digits |
|||
# : comment |