ECL supports all of the Common Lisp numeric tower, which is shown in Table 10.1. The details, however, depend both on the platform on which ECL runs and on the configuration which was chosen when building ECL.
Table 10.1. Numeric types in ECL
Type | Description |
---|---|
fixnum | Signed integer with a number of bits given by
ext:fixnum-bits , fit in a machine word. |
bignum | Arbitrary size integers, only limited by amount of memory. |
ratio | Arbitrary size rational number, made up of two integers. |
short-float | Equivalent to single-float. |
single-float | 32-bits IEEE floating point number. |
double-float | 64-bits IEEE floating point number. |
long-float | Either equivalent to double-float, or a 96/128 bits IEEE floating point number (long double in C/C++). |
rational | An alias for (or integer ratio) |
float | An alias for (or single-float double-float short-float long-float) |
real | An alias for (or real integer float) |
complex | Complex number made of two real numbers of the above mentioned types. |
In general, the size of a FIXNUM is determined by the word size of a machine, which ranges from 32 to 64 bits. Integers larger than this are implemented using the GNU Multiprecision library. Rationals are implemented using two integers, without caring whether they are fixnum or not. Floating point numbers include at least the two IEEE types of 32 and 64 bits respectively. In machines where it is supported, it is possible to associate the lisp LONG-FLOAT with the machine type long double whose size ranges from 96 to 128 bits, and which are a bit slower.