This chapter describes the Common Dylan implementation of arithmetic functions, especially integer arithmetic. It describes a number of extensions to the Dylan language, which are available from the Dylan library. It also describes a generic arithmetic facility that, through the use of other libraries, allows you to extend arithmetic to special number types, such as "big" (64-bit) integers.
Throughout this chapter, arguments are instances of the class specified by the argument name (ignoring any numeric suffixes), unless otherwise noted. Thus, the arguments integer, integer1, and integer2 would all be instances of the class <integer>.
The goals of the extensions to the Dylan language described in this chapter are as follows:
<integer> class and limited-<integer> types to inefficient implementations.
#module is used in this chapter to remove ambiguity.
<integer> has a finite, implementation-dependent range, bounded by the constants $minimum-integer and $maximum-integer.
$maximum-integer is 227-1 and the maximum conforming value for $minimum-integer is -227.
<integer> in this way allows the programmer to stay in the efficient range without requiring exact knowledge of what that range might be. The full generality of extended precision integers is provided by the Big-Integers library, for programmers who actually need that functionality.
<machine-number> to be the type union of <float> and <integer>.
The Dylan library provides implementations of the generic functions and functions described in this chapter. If the result of one of these operations is specified to be an instance of <integer> and the mathematically correct result cannot be represented as an <integer> then an error is signaled. This removes fully generic arithmetic from the Dylan library. In particular, it removes extended integers, ratios, and rectangular complex numbers.