%eclent; ]> Numbers
Numeric types &ECL; supports all of the &CommonLisp; numeric tower, which is shown in . The details, however, depend both on the platform on which &ECL; runs and on the configuration which was chosen when building &ECL;. Numeric types in &ECL; TypeDescription 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.
Random-States &ECL; relies internally on a 32-bit Mersenne-Twister random number generator, using a relatively large buffer to precompute about 5000 pseud-random bytes. This implies also that random states can be printed readably and also read, using the #$ macro. There is no provision to create random states from user arrays, though. Random state is printed unreadably by default. The #$ macro can be used to initialize generatorr with the random seed (an integer), an array of random bytes (mainly used for reading back printed random-state) and an another random-state (syntactic sugar for copying of the random-state).