Skip to content

LEAST-POSITIVE-DOUBLE-FLOAT is same as LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT even though denormalized floats are allowed

I don't know if ECL allows denormalized floats on all platforms, but at least on my platform (Linux x86), the constant LEAST-POSITIVE-DOUBLE-FLOAT is same as LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT even though denormalized floats are allowed. Therefore there exist positive double floats which are less than LEAST-POSITIVE-DOUBLE-FLOAT, which seems unexpected to me.

> least-positive-normalized-double-float
2.2250738585072014d-308
> least-positive-double-float
2.2250738585072014d-308
> (/ least-positive-double-float 2)
1.1125369292536007d-308

CLHS says: "Of these variables, each which has '-normalized' in its name must have a value which is a normalized float, and each which does not have '-normalized' in its name may have a value which is either a normalized float or a denormalized float, as appropriate."

That's not entirely clear, given that "appropriate" is not defined. But I am guessing it is intended that the non-normalized values should be denormalized values if they exist in the implementation.

For the record, SBCL, CMUCL, and GCL all distinguish LEAST-POSITIVE-DOUBLE-FLOAT and LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT (and LEAST-POSITIVE-DOUBLE-FLOAT is a denormalized value).

I didn't check other float types other than double float.

I am working with ECL 16.1.3 but browsing the current source code from Gitlab seems to show that the same values are defined for LEAST-POSITIVE-DOUBLE-FLOAT and LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT, so I guess the status is unchanged since 16.1.3.

> (lisp-implementation-version)
"16.1.3"
> (software-type)
"Linux"
> (software-version)
"3.13.0-44-generic"
> (machine-type)
"i686"
> *features*
(:QUICKLISP :ASDF-PACKAGE-SYSTEM :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
 :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ECL-BYTECMP :WALKER :CDR-1 :CDR-5
 :LINUX :FORMATTER :CDR-7 :ECL-WEAK-HASH :LITTLE-ENDIAN :ECL-READ-WRITE-LOCK
 :LONG-LONG :UINT64-T :UINT32-T :UINT16-T :RELATIVE-PACKAGE-NAMES :LONG-FLOAT
 :UNICODE :DFFI :CLOS-STREAMS :CMU-FORMAT :UNIX :ECL-PDE :DLOPEN :CLOS :THREADS
 :BOEHM-GC :ANSI-CL :COMMON-LISP :IEEE-FLOATING-POINT :CDR-14 :PREFIXED-API
 :FFI :I686 :COMMON :ECL)
> (ext:lisp-implementation-vcs-id)`
"UNKNOWN"

uname -a reports:

Linux freekbox 3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:23:46 UTC 2014 i686 i686 i686 GNU/Linux
Edited by Robert Dodier