dc, an arbitrary precision calculator - 3. Printing Commands

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

# 3. Printing Commands

``p'`
  Prints the value on the top of the stack, without altering the stack. A newline is printed after the value.
``n'`
  Prints the value on the top of the stack, popping it off, and does not print a newline after. (This command is a GNU extension.)
``P'`
  Pops off the value on top of the stack. If it it a string, it is simply printed without a trailing newline. Otherwise it is a number, and the integer portion of its absolute value is printed out as a "base (UCHAR_MAX+1)" byte stream. Assuming that (UCHAR_MAX+1) is 256 (as it is on most machines with 8-bit bytes), the sequence `KSK 0k1/ [_1*]sx d0>x [256~aPd0<x]dsxx sxLKk` could also accomplish this function, except for the side-effect of clobbering the x register. (Details of the behavior with a number are a GNU extension.)
``f'`
  Prints the entire contents of the stack without altering anything. This is a good command to use if you are lost or want to figure out what the effect of some command has been.

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