Next: , Previous: Ratios, Up: Numbers


2.1.3 Floating-Point Numbers

ECL supports two floating point formats: single-float and double-float. These are implemented with IEEE single and double float arithmetic, respectively. short-float is a synonym for single-float, and long-float is a synonym for double-float. The initial value of read-default-float-format is single-float.

Both single-float and double-float are represented with a pointer descriptor, so float operations can cause number consing. Number consing is greatly reduced if type declarations are supplied in programs.

An expression such as (eql 1.0s0 1.0d0) is false, but (eql 1.0f0 1.0d0) is true. Similarly, (typep 1.0l0 'short-float) is false, but (typep 1.0l0 'double-float) is true. For output purposes all floating-point numbers are assumed to be of single or double format.

The floating-point precisions and exponent sizes are:

Format precision exponent
Short 24 bits 8 bits
Single 24 bits 8 bits
Double 53 bits 11 bits
Long 32 bits 11 bits

There is no “minus zero.” (eql 0.0 -0.0) is true.