There are a few more special expressions that are provided in
bc
. These have to do with user-defined functions and standard
functions. They all appear as
"name(
parameters)
". See section Functions, for
user-defined functions. The standard functions are:
length ( expression )
read ( )
read
function (an extension) will read a number from the
standard input, regardless of where the function occurs. Beware, this
can cause problems with the mixing of data and program in the standard
input. The best use for this function is in a previously written
program that needs input from the user, but never allows program code to
be input from the user. The value of the read
function is the
number read from the standard input using the current value of the
variable ibase for the conversion base.
scale ( expression )
scale
function is the number of digits after the
decimal point in the expression.
sqrt ( expression )
sqrt
function is the square root of the
expression. If the expression is negative, a run time error is
generated.
Go to the first, previous, next, last section, table of contents.