bc is a language (and compiler) whose syntax resembles that of C, but with unlimited-precision arithmetic. bc consists of identifiers, keywords, and symbols, which are briefly described in the following entries. Examples are given at the end.
Interactively perform arbitrary-precision arithmetic or convert numbers from one base to another. Input can be taken from files or read from the standard input. To exit, type quit or EOF.
- -h, --help
Print help message and exit.
- -i, --interactive
- -l, --mathlib
Make functions from the math library available.
- -s, --standard
Ignore all extensions, and process exactly as in POSIX.
- -w, --warn
When extensions to POSIX bc are used, print a warning.
- -q, --quiet
Do not display welcome message.
- -v, --version
Print version number.
An identifier is a series of one or more characters. It must begin with a lowercase letter but may also contain digits and underscores. No uppercase letters are allowed. Identifiers are used as names for variables, arrays, and functions. Variables normally store arbitrary-precision numbers. Within the same program you may name a variable, an array, and a function using the same letter. The following identifiers would not conflict:
Element i of array x. i can range from 0 to 2047 and can also be an expression.
Call function x with parameters y and z.
ibase, obase, scale, and last store a value. Typing them on a line by themselves displays ...