dc, an arbitrary precision calculator - 7. Parameters

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

# 7. Parameters

DC has three parameters that control its operation: the precision, the input radix, and the output radix. The precision specifies the number of fraction digits to keep in the result of most arithmetic operations. The input radix controls the interpretation of numbers typed in; all numbers typed in use this radix. The output radix is used for printing numbers.

The input and output radices are separate parameters; you can make them unequal, which can be useful or confusing. The input radix must be between 2 and 16 inclusive. The output radix must be at least 2. The precision must be zero or greater. The precision is always measured in decimal digits, regardless of the current input or output radix.

``i'`
  Pops the value off the top of the stack and uses it to set the input radix.
``o'`
  Pops the value off the top of the stack and uses it to set the output radix.
``k'`
  Pops the value off the top of the stack and uses it to set the precision.
``I'`
  Pushes the current input radix on the stack.
``O'`
  Pushes the current output radix on the stack.
``K'`
  Pushes the current precision on the stack.

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