next up previous contents
Next: Arithmetical operators Up: CHAPTER.5: NUMERICAL AND Previous: The representation of

Basic arithmetical facilities

There are several procedures for manipulating numbers of all types. The most commonly used ones are represented by `infix' identifiers. That is they can be used to create expressions without using parentheses, e.g.

    3 + 5,  77 * 9,
although it is legal to write +(3, 5) or *(77, 9) instead if you prefer.

The operations listed below are available for constructing arithmetic expressions. They all take numbers of every variety in all combinations. I.e. they are "overloaded" or "polymorphic" operators. (The exception is "mod" which cannot be applied to complex numbers.)

When the result is a floating point number, whether it is represented as a decimal (single precision) or ddecimal (double precision) will depend on whether the global variable popdprecision is false or not, as explained below.

In general the rules in Pop-11 for deciding on the type of result to be produced by a mathematical procedure conform to standard mathematical expectations. For example, a decimal divided by an integer will give a decimal, unless popdprecision is true, in which case it will give a ddecimal. Division of one integer by another may produce a surprise in the form of a ratio, as described below.



Aaron Sloman
Fri Jan 2 03:17:44 GMT 1998