167 lines
9.9 KiB
HTML
167 lines
9.9 KiB
HTML
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>CLHS: Issue FLOATING-POINT-CONDITION-NAMES Writeup</TITLE>
|
|
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
|
|
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
|
|
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
|
|
<LINK REL=TOP HREF="../Front/index.htm">
|
|
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
|
|
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
|
|
<LINK REL=PREV HREF="../Issues/iss162_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss163.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss164_w.htm">
|
|
</HEAD>
|
|
<BODY>
|
|
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="../Issues/iss162_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss163.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss164_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue FLOATING-POINT-CONDITION-NAMES Writeup</H2>
|
|
|
|
<PRE><B>Forum:</B> Cleanup<P>
|
|
<B>Issue:</B> <A HREF="iss163.htm">FLOATING-POINT-CONDITION-NAMES</A><P>
|
|
<B>References:</B> CLtL, Section 12.10 "Implementation Parameters" (for floats)<P>
|
|
CLtL, P.448 "*features*"<P>
|
|
IEEE Standard for Binary Floating-Point Arithmetic<P>
|
|
Related Issues: <A HREF="iss162.htm">FLOAT-UNDERFLOW</A><P>
|
|
ERROR-CHECKING-IN-NUMBERS-CHAPTER<P>
|
|
<B>Category:</B> ADDITION<P>
|
|
<B>Edit History:</B> V1, 30 Oct 1989, JonL White<P>
|
|
V2, 4 Dec 1990, Kent M. Pitman (amendments per X3J13)<P>
|
|
<P>
|
|
<B>Problem Description:<P>
|
|
</B><P>
|
|
The currently proposed error system contains names for three conditions<P>
|
|
related to floating-point operations: <A REL=DEFINITION HREF="../Body/e_floa_3.htm#floating-point-underflow"><B>floating-point-underflow</B></A>,<P>
|
|
<A REL=DEFINITION HREF="../Body/e_floa_2.htm#floating-point-overflow"><B>floating-point-overflow</B></A>, and <A REL=DEFINITION HREF="../Body/e_divisi.htm#division-by-zero"><B>division-by-zero</B></A>. Probably a majority<P>
|
|
of implementation will be running on machines that support the IEEE<P>
|
|
floating point standard; but there is no name for the remaining two out <P>
|
|
of the five mandated trapping conditions, namely <A REL=DEFINITION HREF="../Body/e_floa_1.htm#floating-point-inexact"><B>floating-point-inexact</B></A><P>
|
|
and <A REL=DEFINITION HREF="../Body/e_floati.htm#floating-point-invalid-operation"><B>floating-point-invalid-operation</B></A>.<P>
|
|
<P>
|
|
Furthermore, even though the condition names may appear in an image,<P>
|
|
it is not clear that such traps are enabled at every point in time.<P>
|
|
The IEEE <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> specifies that user-level programs ought to have<P>
|
|
the capability of selectively enabling or disabling its five traps;<P>
|
|
and other implementations may run on a variety of hardware configurations<P>
|
|
for which the traps possible vary from host to host. However, there is<P>
|
|
no current way for user-code to ask (1) what conditions are in fact<P>
|
|
supporting floating-point traps, nor to ask (2) just what traps are <P>
|
|
currently active<P>
|
|
<P>
|
|
Note that some very simple implementations might not be able to cause<P>
|
|
trapping even for floating-point-underflow; and in other implementations,<P>
|
|
the relevant traps may vary on a host-to-host basic, depending on what<P>
|
|
particular optional hardware is available on that host. For example,<P>
|
|
Sun3 workstations come in three configurations: one with only software <P>
|
|
floating-point support, one with a Motorola MC68881 attached co-processor, <P>
|
|
and one with both an MC68881 and a Weitek Floating Point "Accelerator"; <P>
|
|
the increasing hardware complement gives rise to an increasing number of <P>
|
|
implementation-specific traps. Even within the IEEE <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A>, it is <P>
|
|
possible for a conforming implementation to make a refinement of the five <P>
|
|
suggested traps [the MC68881 partitions one of the traps into three, <P>
|
|
giving a total of eight]; so even though one knows that an implementation <P>
|
|
is IEEE compatible, it still makes sense to ask what conditions are <P>
|
|
supportable as floating-point traps.<P>
|
|
<P>
|
|
Proposal (<A HREF="iss163.htm">FLOATING-POINT-CONDITION-NAMES:X3J13-NOV-89</A>)<P>
|
|
<P>
|
|
1. Add <A REL=DEFINITION HREF="../Body/e_floati.htm#floating-point-invalid-operation"><B>FLOATING-POINT-INVALID-OPERATION</B></A> and <A REL=DEFINITION HREF="../Body/e_floa_1.htm#floating-point-inexact"><B>FLOATING-POINT-INEXACT</B></A><P>
|
|
as conditions which are sub-conditions of <A REL=DEFINITION HREF="../Body/e_arithm.htm#arithmetic-error"><B>ARITHMETIC-ERROR</B></A>.<P>
|
|
<P>
|
|
The intent is that if condition FOO is a currently enabled floating<P>
|
|
point trap, then whenever that particular situation arises the<P>
|
|
system will arrange to signal the Lisp condition FOO. The means for<P>
|
|
enabling and disabling traps is not addressed in this proposal.<P>
|
|
<P>
|
|
Proposal (FLOATING-POINT-CONDITION-NAMES:ADD-MINIMAL-IEEE)<P>
|
|
<P>
|
|
1. Add <A REL=DEFINITION HREF="../Body/e_floati.htm#floating-point-invalid-operation"><B>FLOATING-POINT-INVALID-OPERATION</B></A> and <A REL=DEFINITION HREF="../Body/e_floa_1.htm#floating-point-inexact"><B>FLOATING-POINT-INEXACT</B></A><P>
|
|
as conditions which are sub-conditions of <A REL=DEFINITION HREF="../Body/e_arithm.htm#arithmetic-error"><B>ARITHMETIC-ERROR</B></A>.<P>
|
|
2. Add a global parameter SUPPORTED-FLOATING-POINT-CONDITIONS which<P>
|
|
is to contain a list of all the condition names that can, in that<P>
|
|
implementation, be enabled as floating-point traps; this is to<P>
|
|
be an "implementation revealing" parameter.<P>
|
|
3. Add a function of no arguments ENABLED-FLOATING-POINT-TRAPS which<P>
|
|
returns a list of condition names for all currently enabled<P>
|
|
floating point trapping conditions.<P>
|
|
<P>
|
|
The intent is that if condition FOO is a currently enabled floating<P>
|
|
point trap, then whenever that particular situation arises the<P>
|
|
system will arrange to signal the Lisp condition FOO. The means for<P>
|
|
enabling and disabling traps is not addressed in this proposal.<P>
|
|
<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
Many Common Lisp implementations do in fact run on hardware that<P>
|
|
supports the IEEE floating-point standard; a minimal requirement<P>
|
|
for porting between these implementations is that they all use the<P>
|
|
same name for the five IEEE-mandated floating-point conditions.<P>
|
|
Since at least some implementations will <A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> means for selective<P>
|
|
enabling and disabling of various floating-point traps, then the <P>
|
|
user must be able to query the system to find out what the current<P>
|
|
state is, and what states are supportable.<P>
|
|
<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Lucid Common Lisp supports this much; moreover, it uses <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> on<P>
|
|
(ENABLED-FLOATING-POINT-TRAPS) as the primary means to alter the<P>
|
|
currently-enabled traps.<P>
|
|
<P>
|
|
<P>
|
|
<B>Cost to implementors:<P>
|
|
</B><P>
|
|
Trivial.<P>
|
|
<P>
|
|
<P>
|
|
<B>Cost to users:<P>
|
|
</B><P>
|
|
None; this is an upward-compatible addition.<P>
|
|
<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
Portability of a greater amount of user code; portability of "skills",<P>
|
|
since IEEE support is so common.<P>
|
|
<P>
|
|
<P>
|
|
<B>Aesthetics:<P>
|
|
</B><P>
|
|
It is better for all IEEE implementations to use the same names for<P>
|
|
these conditions, rather than have them vary from one to another.<P>
|
|
It is also probably better for non-IEEE implementations to use the<P>
|
|
IEEE condition names where appropriate, just to minimize the <P>
|
|
conceptual overload.<P>
|
|
<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
If an implementation is to claim full IEEE support, then it ought to <P>
|
|
<A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> some means of enabling and catching these five IEEE-mandated<P>
|
|
traps. Then it would be appropriate to put :IEEE-FLOATING-POINT on<P>
|
|
the list <A REL=DEFINITION HREF="../Body/v_featur.htm#STfeaturesST"><B>*FEATURES*</B></A> (see CLtL, P.448).<P>
|
|
<P>
|
|
Moon and JonL privately discussed some means for enabling and<P>
|
|
disabling various floating-point traps, back in June 1989 when the <P>
|
|
<A HREF="iss162.htm">float-underflow</A> proposal was under discussion; they came to the <P>
|
|
conclusion that "getting the design right and efficient" was more <P>
|
|
than a few minutes worth of work, and so postponed further work on it.<P>
|
|
<P>
|
|
<P>
|
|
[The IEEE <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> apparently goes by the name of ANSI-IEEE Std 754-1985; <P>
|
|
my working copy is Draft 10.0 from 1982. I don't think there are great <P>
|
|
variances between them. -- JonL --]<P>
|
|
<P>
|
|
</PRE>
|
|
<HR>
|
|
|
|
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
|
|
|
|
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
|
|
</BODY>
|
|
</HTML>
|