DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(bc.info.gz) About Expressions and Special Variables

Info Catalog (bc.info.gz) Expressions (bc.info.gz) Expressions (bc.info.gz) Basic Expressions
 
 About Expressions and Special Variables
 =======================================
 
    The numbers are manipulated by expressions and statements.  Since
 the language was designed to be interactive, statements and expressions
 are executed as soon as possible.  There is no main program.  Instead,
 code is executed as it is encountered.  (Functions, discussed in detail
 later, are defined when encountered.)
 
    A simple expression is just a constant. `bc' converts constants into
 internal decimal numbers using the current input base, specified by the
 variable IBASE. (There is an exception in functions.)  The legal values
 of IBASE are 2 through 16.  Assigning a value outside this range to
 IBASE will result in a value of 2 or 16.  Input numbers may contain the
 characters 0-9 and A-F. (Note: They must be capitals.  Lower case
 letters are variable names.)  Single digit numbers always have the
 value of the digit regardless of the value of IBASE. (i.e. A = 10.)
 For multi-digit numbers, `bc' changes all input digits greater or equal
 to IBASE to the value of IBASE-1.  This makes the number `FFF' always
 be the largest 3 digit number of the input base.
 
    Full expressions are similar to many other high level languages.
 Since there is only one kind of number, there are no rules for mixing
 types.  Instead, there are rules on the scale of expressions.  Every
 expression has a scale.  This is derived from the scale of original
 numbers, the operation performed and in many cases, the value of the
 variable SCALE. Legal values of the variable SCALE are 0 to the maximum
 number representable by a C integer.
 
Info Catalog (bc.info.gz) Expressions (bc.info.gz) Expressions (bc.info.gz) Basic Expressions
automatically generated byinfo2html