.\" Copyright (c) 1990 The Regents of the University of California.
.\" %sccs.include.proprietary.roff%
.\" @(#)bc.1 6.8 (Berkeley) %G%
.Nd arbitrary-precision arithmetic language and calculator
is an interactive processor for a language which resembles
C but provides unlimited precision arithmetic.
It takes input from any files given, then reads
of an arbitrary precision math library.
is actually a preprocessor for
which it invokes automatically, unless the
input is sent to the standard output instead.
E means expression, S means statement.
.Bd -unfilled -offset indent -compact
are enclosed in /* and */.
.Bd -unfilled -offset indent -compact
The words `ibase', `obase', and `scale'
.Bd -unfilled -offset indent -compact
arbitrarily long numbers with optional sign and decimal point.
length ( E ) number of significant decimal digits
scale ( E ) number of digits right of decimal point
.Bd -unfilled -offset indent -compact
\&+ \- * / % ^ (% is remainder; ^ is power)
\&++ \-\- (prefix and postfix; apply to names)
.Bd -unfilled -offset indent -compact
.Bd -unfilled -offset indent -compact
.Bl -tag -width j(n,x) -offset indent -compact
All function arguments are passed by value.
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.
influences the number of digits to be retained on arithmetic
operations in the manner of
set the input and output number radix respectively.
The same letter may be used as an array, a function,
and a simple variable simultaneously.
All variables are global to the program.
`Auto' variables are pushed down during function calls.
When using arrays as function arguments
or defining them as automatic variables
empty square brackets must follow the array name.
.Bd -literal -offset indent
defines a function to compute an approximate value of
the exponential function and
.Dl for(i=1; i<=10; i++) e(i)
prints approximate values of the exponential function of
.\" /usr/lib/lib.b mathematical library
.Bl -tag -width xxxxx -compact
.%T "BC \- An arbitrary precision desk-calculator language"
No &&, \(or\\(or, or ! operators.
statement must have all three E's.
is interpreted when read, not when executed.