dc, an arbitrary precision calculator - 6. Registers

Go to the first, previous, next, last section, table of contents.

# 6. Registers

DC provides at least 256 memory registers, each named by a single character. You can store a number in a register and retrieve it later.

``sr'`
  Pop the value off the top of the stack and store it into register r.
``lr'`
  Copy the value in register r, and push it onto the stack. This does not alter the contents of r. Each register also contains its own stack. The current register value is the top of the register's stack.
``Sr'`
  Pop the value off the top of the (main) stack and push it onto the stack of register r. The previous value of the register becomes inaccessible.
``Lr'`
  Pop the value off the top of register r's stack and push it onto the main stack. The previous value in register r's stack, if any, is now accessible via the ``lr'` command.

Go to the first, previous, next, last section, table of contents.