Category:Dc: Difference between revisions
Content added Content deleted
(dc commands) |
(array correction & mine also has ~; GNU extension?) |
||
Line 3: | Line 3: | ||
Commands in POSIX dc |
Commands in POSIX dc |
||
number : push a number |
number : push a number |
||
+ - / * % ^ : arithmetic operations |
+ - / * % ^ : arithmetic operations: add sub div mul mod exp |
||
sx Sx : pop the stack and save or push it to register x |
sx Sx : pop the stack and save or push it to register x |
||
lx Lx : copy | pop the register x to main stack. |
lx Lx : copy | pop the register x to main stack. |
||
Line 29: | Line 29: | ||
? : read input and execute. |
? : read input and execute. |
||
Y : debug information |
Y : debug information |
||
a b |
a b :r : store r[b] = a (r is register) |
||
a ;r : retrieve r[b] |
a ;r : retrieve r[b] |
||
Line 35: | Line 35: | ||
n : print value without a new line |
n : print value without a new line |
||
~ : arithmetic - divmod |
|||
| : arithmetic - modular exponentiation |
| : arithmetic - modular exponentiation |
||
r : swap the top two elements |
r : swap the top two elements |