Research V6 development
authorRobert Morris <rhm@research.uucp>
Fri, 27 Jun 1975 00:35:41 +0000 (19:35 -0500)
committerRobert Morris <rhm@research.uucp>
Fri, 27 Jun 1975 00:35:41 +0000 (19:35 -0500)
Work on file usr/doc/man/man1/bc.1

Synthesized-from: v6

usr/doc/man/man1/bc.1 [new file with mode: 0644]

diff --git a/usr/doc/man/man1/bc.1 b/usr/doc/man/man1/bc.1
new file mode 100644 (file)
index 0000000..5d977e8
--- /dev/null
@@ -0,0 +1,161 @@
+.th BC I 2/20/75
+.sh NAME
+bc \*- arbitrary precision interactive language
+.sh SYNOPSIS
+.bd bc
+[
+.bd \-l
+] [ file ... ]
+.sh DESCRIPTION
+.it Bc
+is an interactive processor for a language which resembles
+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 
+.it bc
+programs is as follows;
+E means expression, S means statement.
+.s3
+.lp +6 6
+Comments
+.br
+are enclosed in /* and */.
+.s3
+.lp +6 6
+Names
+.br
+letters a\-z
+.br
+array elements: letter[E]
+.br
+The words `ibase', `obase', and `scale'
+.s3
+.lp +6 6
+Other operands
+.br
+arbitrarily long numbers with optional sign and decimal point.
+.br
+( E )
+.br
+sqrt ( E )
+.br
+<letter> ( E , ... , E )
+.s3
+.lp +6 6
+Operators
+.br
++  \-  *  /  %  ^
+.br
+++   \-\-         (prefix and postfix; apply to names)
+.br
+==  <=  >=  !=  <  >
+.br
+=  =+  =\-  =*  =/  =%  =^
+.br
+.s3
+.lp +6 6
+Statements
+.br
+E
+.br
+{ S ; ... ; S }
+.br
+if ( E ) S
+.br
+while ( E ) S
+.br
+for ( E ; E ; E ) S
+.br
+null statement
+.br
+break
+.br
+quit
+.s3
+.lp +6 6
+Function definitions are exemplified by
+.br
+define <letter> ( <letter> ,..., <letter> ) {
+.br
+       auto <letter>, ... , <letter>
+.br
+       S; ... S
+.br
+       return ( E )
+.br
+}
+.s3
+.i0
+.dt
+All function arguments are passed by value.
+.s3
+The value of a statement that is an expression is printed
+unless the main operator is an assignment.
+Either semicolons or newlines may separate statements.
+Assignment to
+.it scale
+influences the number of digits to be retained on arithmetic
+operations.
+Assignments to
+.it ibase
+or
+.it obase
+set the input and output number radix respectively.
+.s3
+The same letter may be used as an array name, a function name,
+and a simple variable simultaneously.
+`Auto' variables are saved and restored during function calls.
+All other variables are global to the program.
+When using arrays as function arguments
+or defining them as automatic variables
+empty square brackets must follow the array name.
+.s3
+For example
+.s3
+.nf
+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
+       }
+}
+.s3
+.fi
+defines a function to compute an approximate value of
+the exponential function and
+.s3
+.nf
+       for(i=1; i<=10; i++) e(i)
+.fi
+.s3
+prints approximate values of the exponential function of
+the first ten integers.
+.sh FILES
+/usr/lib/lib.b mathematical library
+.sh "SEE ALSO"
+.it dc
+(I),
+C Reference Manual,
+``BC \- An Arbitrary Precision Desk-Calculator Language.''
+.sh BUGS
+No &&, | | yet.
+.br
+.it for
+statement must have all three E's
+.br
+.it quit
+is interpreted when read, not when executed.