Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.


3.2.1 Mathematics

All the standard mathematical operators are supported in E. You can do addition, subtraction, multiplication and division. Other functions such as sine, modulus and square-root can also be used as they are part of the Amiga system libraries, but we only need to know about simple mathematics at the moment. The `+' character is used for addition, `-' for subtraction, `*' for multiplication (it's the closest you can get to a multiplication sign on a keyboard without using the letter x), and `/' for division (be careful not to confuse the `\' used in strings with `/' used for division). The following are examples of expressions:

  1+2+3+4
  15-5
  5*2
  330/33
  -10+20
  3*3+1

Each of these expressions yields ten as its result. The last example is very carefully written to get the precedence correct (see 3.2.3 Precedence and grouping).

All the above expressions use integer operators, so they manipulate integers, giving integers as results. Floating-point numbers are also supported by E, but using them is quite complicated (see 15 Floating-Point Numbers). (Floating-point numbers can represent both very small fractions and very large integers, but they have a limited accuracy, i.e., a limited number of significant digits.)


Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.