


      DDDDCCCC((((1111))))                       ((((UUUUNNNNIIIIXXXX 5555....0000))))                      DDDDCCCC((((1111))))



      NNNNAAAAMMMMEEEE
           dc - desk calculator

      SSSSYYYYNNNNTTTTAAAAXXXX
           ddddcccc [ file ]

      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
           _D_c is an arbitrary precision arithmetic package.  Ordinarily
           it operates on decimal integers, but one may specify an
           input base, output base, and a number of fractional digits
           to be maintained.  The overall structure of _d_c is a stacking
           (reverse Polish) calculator.  If an argument is given, input
           is taken from that file until its end, then from the
           standard input.  The following constructions are recognized:

           _n_u_m_b_e_r
                 The value of the number is pushed on the stack.  A
                 number is an unbroken string of the digits 0-9.  It
                 may be preceded by an underscore (____) to input a
                 negative number.  Numbers may contain decimal points.

           ++++ ---- //// **** %%%% ^^^^
                 The top two values on the stack are added (++++),
                 subtracted (----), multiplied (****), divided (////),
                 remaindered (%%%%), or exponentiated (^^^^).  The two
                 entries are popped off the stack; the result is pushed
                 on the stack in their place.  Any fractional part of
                 an exponent is ignored.

           ssss_x    The top of the stack is popped and stored into a
                 register named _x, where _x may be any character.  If
                 the ssss is capitalized, _x is treated as a stack and the
                 value is pushed on it.

           llll_x    The value in register _x is pushed on the stack.  The
                 register _x is not altered.  All registers start with
                 zero value.  If the llll is capitalized, register _x is
                 treated as a stack and its top value is popped onto
                 the main stack.

           dddd     The top value on the stack is duplicated.

           pppp     The top value on the stack is printed.  The top value
                 remains unchanged.  PPPP interprets the top of the stack
                 as an ASCII string, removes it, and prints it.

           ffff     All values on the stack are printed.

           qqqq     exits the program.  If executing a string, the
                 recursion level is popped by two.  If qqqq is
                 capitalized, the top value on the stack is popped and
                 the string execution level is popped by that value.



      Page 1                                                   (9010-E)






      DDDDCCCC((((1111))))                       ((((UUUUNNNNIIIIXXXX 5555....0000))))                      DDDDCCCC((((1111))))



           xxxx     treats the top element of the stack as a character
                 string and executes it as a string of _d_c commands.

           XXXX     replaces the number on the top of the stack with its
                 scale factor.

           [[[[ ............ ]]]]
                 puts the bracketed ASCII string onto the top of the
                 stack.

           <<<<_x   >>>>_x   ====_x
                 The top two elements of the stack are popped and
                 compared.  Register _x is evaluated if they obey the
                 stated relation.

           vvvv     replaces the top element on the stack by its square
                 root.  Any existing fractional part of the argument is
                 taken into account, but otherwise the scale factor is
                 ignored.

           !!!!     interprets the rest of the line as a UNIX System
                 command.

           cccc     All values on the stack are popped.

           iiii     The top value on the stack is popped and used as the
                 number radix for further input.  IIII pushes the input
                 base on the top of the stack.

           oooo     The top value on the stack is popped and used as the
                 number radix for further output.

           OOOO     pushes the output base on the top of the stack.

           kkkk     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 multiplication, division, and exponentiation.
                 The interaction of scale factor, input base, and
                 output base will be reasonable if all are changed
                 together.

           zzzz     The stack level is pushed onto the stack.

           ZZZZ     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.

           ;;;; ::::   are used by _b_c for array operations.




      Page 2                                                   (9010-E)






      DDDDCCCC((((1111))))                       ((((UUUUNNNNIIIIXXXX 5555....0000))))                      DDDDCCCC((((1111))))



      EEEEXXXXAAAAMMMMPPPPLLLLEEEE
           This example prints the first ten values of n!:

              [la1+dsa*pla10>y]sy
              0sa1
              lyx

      SSSSEEEEEEEE AAAALLLLSSSSOOOO
           bc(1), which is a preprocessor for _d_c providing infix
           notation and a C-like syntax which implements functions and
           reasonable control structures for programs.

      DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
           _x _i_s _u_n_i_m_p_l_e_m_e_n_t_e_d
                where _x is an octal number.

           _s_t_a_c_k _e_m_p_t_y
                for not enough elements on the stack to do what was
                asked.

           _O_u_t _o_f _s_p_a_c_e
                when the free list is exhausted (too many digits).

           _O_u_t _o_f _h_e_a_d_e_r_s
                for too many numbers being kept around.

           _O_u_t _o_f _p_u_s_h_d_o_w_n
                for too many items on the stack.

           _N_e_s_t_i_n_g _D_e_p_t_h
                for too many levels of nested execution.
























      Page 3                                                   (9010-E)



