BC(I)                        2/20/75                        BC(I)

     bc - arbitrary precision interactive language

     bc [ -l ] [ file ... ]

     Bc  is  an interactive processor for a language which resem-
     bles C but  provides  unlimited  precision  arithmetic.   It
     takes  input  from  any files given, then reads the standard
     input.  The `-l' argument stands for the name of  a  library
     of mathematical subroutines which contains sine (named `s'),
     cosine (`c'), arctangent (`a'), natural logarithm (`l'), and
     exponential  (`e').   The  syntax for bc programs is as fol-
     lows; E means expression, S means statement.

           are enclosed in /* and */.

           letters a-z
           array elements: letter[E]
           The words `ibase', `obase', and `scale'

     Other operands
           arbitrarily long numbers with optional sign and  deci-
           mal point.
           ( E )
           sqrt ( E )
           <letter> ( E , ... , E )

           +  -  *  /  %  ^
           ++   --         (prefix and postfix; apply to names)
           ==  <=  >=  !=  <  >
           =  =+  =-  =*  =/  =%  =^

           { S ; ... ; S }
           if ( E ) S
           while ( E ) S
           for ( E ; E ; E ) S
           null statement

     Function definitions are exemplified by
           define <letter> ( <letter> ,..., <letter> ) {
                 auto <letter>, ... , <letter>
                 S; ... S
                 return ( E )

     All function arguments are passed by value.

                              - 1 -

BC(I)                        2/20/75                        BC(I)

     The  value  of  a statement that is an expression is printed
     unless the main operator is  an  assignment.   Either  semi-
     colons  or  newlines may separate statements.  Assignment to
     scale influences the number of  digits  to  be  retained  on
     arithmetic  operations.   Assignments  to ibase or obase set
     the input and output number radix respectively.

     The same letter may be used as an  array  name,  a  function
     name,  and  a  simple variable simultaneously.  `Auto' vari-
     ables are saved and restored  during  function  calls.   All
     other  variables  are global to the program.  When using ar-
     rays as function arguments or  defining  them  as  automatic
     variables  empty square brackets must follow the array name.

     For example

     scale = 20
     define e(x){
             auto a, b, c, i, s
             a = 1
             b = 1
             s = 1
             for(i=1; 1==1; i++){
                     a = a*x
                     b = b*i
                     c = a/b
                     if(c == 0) return(s)
                     s = s+c

     defines a function to compute an approximate  value  of  the
     exponential function and

             for(i=1; i<=10; i++) e(i)

     prints approximate values of the exponential function of the
     first ten integers.

     /usr/lib/lib.b  mathematical library

     dc(I), C Reference Manual, ``BC -  An  Arbitrary  Precision
     Desk-Calculator Language.''

     No &&, | | yet.
     for statement must have all three E's
     quit is interpreted when read, not when executed.

                              - 2 -