Go to the first, previous, next, last section, table of contents.


Special Expressions

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 )
The value of the length function is the number of significant digits in the expression.
read ( )
The 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 )
The value of the scale function is the number of digits after the decimal point in the expression.
sqrt ( expression )
The value of the 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.