Subject: Re: Show me a better way?
From: (Rob Warnock)
Date: Mon, 02 Mar 2009 00:26:36 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
D Herring  <> wrote:
| Rob Warnock wrote:
| > In fact, AFAICT a conforming CL *must* provide a System Class for -- and
| > thus be able to dispatch on -- at least INTEGER, RATIO, FLOAT, COMPLEX
| > and all of their their superclasses (e.g., RATIONAL, REAL, NUMBER).
| > 
| > The reason [again, AFAICT] that a conforming CL need not provide
| > System Classes for the ${PRECISION}-FLOAT subtypes of FLOAT is that
| > the ANSI Standard permits them to be degenerate, see:
| ...
| > Given that, the standard *can't* mandate that (say) SINGLE-FLOAT and
| > DOUBLE-FLOAT dispatch differently, since they might be identical types.
| Why couldn't they have simply treated specializations on aliases the 
| same as repeated methods with the same specializations?  (i.e. last 
| defmethod wins)

Individual implementations *might* choose to do so, 
say on SHORT-FLOAT and SINGLE-FLOAT, but only if 
returned T. [Think about why that must be the case.] 

But the CLHS doesn't even require that the types 
it certainly doesn't require the kind of aliasing
you request.

| IMHO allowing double-float to alias with single-float is no longer 
| justifiable (post IEEE-754 world).  If it ever was, I wish the 
| standard had said that a conforming impl was free to not provide 
| double-float rather than alias it down to single-float. 

CL was not defined in a "post IEEE-754 world". While the X3J13
Commmittee was certainly quite aware of IEEE-754 [e.g., see CLHS
"Issue IEEE-ATAN-BRANCH-CUT" and its reference to consultations
with Kahan], there were still numerous other floating-point formats
quite active at the time [e.g., DEC PDP-10, DEC VAX, IBM 360/370,
CDC (?), Motorola 68k, etc.]. They were obligated to provide a spec
that accommodated *all* of them as best as possible. That it is not
worse than it is is almost a miracle!  ;-}

| Floating-point algorithms need certain guarantees of range and 
| precision... the standard does not provide the necessary information 
| (merely a table of recommended minimum sizes).  And why was 
| short/single-float *or* single/double-float a good idea?

See above. I wasn't there but I'd suspect that there would have
been an irreconcilable split had both not been allowed. Also,
see Section 3.4 "Numerical Facilities" in this classic:
    "The Evolution of Lisp", Guy Steele & Peter Gabriel, HOPL 1992

which contains many details about the context of the design of
the arithmetic [including floating point] in CL [e.g., the four
FLOAT precisions were driven by the needs of the S-1 project,
the (ATANH -2) quick test, other amusing snippets].

But perhaps one of those who were there might want to give a (short!)
recap of the technical and/or political issues of the day...  ;-}


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607