Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
d
dc(1) dc(1)
o The top value on the stack is popped and used as the number radix for further output.
See below for notes on output base.
O pushes the output base on the top of the stack.
k the top of the stack is popped, and that value is used as a non-negative scale factor:
the appropriate number of places are printed on output, and maintained during multi-
plication, division, and exponentiation. The interaction of scale factor, input base, and
output base will be reasonable if all are changed together.
K pushes the scale factor on the top of the stack.
z The stack level is pushed onto the stack.
Z replaces the number on the top of the stack with its length.
? A line of input is taken from the input source (usually the terminal) and executed.
; and : Used by bc for array operations.
Y Generates debugging output for dc itself.
The input base may be any number, but only the digits 0-9 and A-F are available for input, thus limiting
the usefulness of bases outside the range 1-16. All 16 possible digits may be used in any base; they always
take their conventional values.
The output base may be any number. Bases in the range of 2-16 generate the "usual" results, with the
letters A-F representing the values from 10 through 16. Bases 0 and 1 generate a string of 1
s whose length
is the value of the number. Base 1 generates a similar string consisting of
ds. Other bases have each
"digit" represented as a (multi-digit) decimal number giving the ordinal of that digit. Each "digit" is signed
for negative bases. "Digits" are separated by spaces. Given the definition of output base, the command
Op
always yields "10" (in a representation appropriate to the base);
O1-p yields useful information about the
output base.
DIAGNOSTICS
x
is unimplemented Where x is an octal number.
stack empty There are insufficient elements on the stack to do what was asked.
Out of space The free list is exhausted (too many digits).
Out of headers Too many numbers are being kept around.
Out of pushdown Too many items are on the stack.
Nesting Depth There are too many levels of nested execution.
EXAMPLES
This example prints the first ten values of n! (n factorial):
[la1+dsa*pla10>y]sy
0sa1
lyx
SEE ALSO
bc(1).
DC: An Interactive Desk Calculator tutorial in Number Processing Users Guide.
HP-UX Release 11i: December 2000 2 Section 1171
___
___