150 lines
8.7 KiB
HTML
150 lines
8.7 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 FLOAT-UNDERFLOW 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/iss161_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss162.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss163_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/iss161_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss162.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss163_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue FLOAT-UNDERFLOW Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss162.htm">FLOAT-UNDERFLOW</A><P>
|
|
<B>References:</B> CLtL p.231<P>
|
|
Related issues:LEAST-POSITIVE-SINGLE-FLOAT-NORMALIZATION (not written up),<P>
|
|
ERROR-CHECKING-IN-NUMBERS-CHAPTER<P>
|
|
<B>Category:</B> ADDITION and CLARIFICATION<P>
|
|
<B>Edit history:</B> Version 1, 9-May-89, by Moon (suggested in January, but<P>
|
|
the writeup was late)<P>
|
|
Version 2, 23-May-89, by Moon (final cleanup for post-CLtL<P>
|
|
changes to Common Lisp)<P>
|
|
Version 3, 18-Jun-89, by Moon (update based on discussion<P>
|
|
within the cleanup subcommittee)<P>
|
|
Version 4, 28-Jul-89, by Pitman (modify per X3J13 vote)<P>
|
|
<B>Status:</B> Passed FLOAT-UNDERFLOW:ADD-CONTROLS-1-2, June 1989<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B> <P>
|
|
In implementations with denormalized floating point numbers (as in IEEE<P>
|
|
floating point), which are closer to zero than any non-zero normalized<P>
|
|
floating point numbers, should the LEAST-POSITIVE- and<P>
|
|
MOST-POSITIVE-XXX-FLOAT constants be the normalized or denormalized<P>
|
|
values? Which is preferred depends on the application. Note that in<P>
|
|
IEEE floating point, denormalized results are normally only produced<P>
|
|
as a result of underflow.<P>
|
|
<P>
|
|
Also, there is no portable way to control what happens when a floating<P>
|
|
point number underflows. Sometimes this is an error, sometimes not.<P>
|
|
Indeed there is no mention at all of underflow or overflow in CLtL.<P>
|
|
Pending issue ERROR-CHECKING-IN-NUMBERS-CHAPTER does not mention floating<P>
|
|
point overflow or underflow. Draft ANSI Common Lisp specifies error<P>
|
|
conditions named <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_floa_3.htm#floating-point-underflow"><B>FLOATING-POINT-UNDERFLOW</B></A><P>
|
|
but does not specify the circumstances in which they are signalled and<P>
|
|
does not <A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> any way to suppress underflow checking.<P>
|
|
<P>
|
|
<B>Proposal (FLOAT-UNDERFLOW:ADD-VARIABLES):<P>
|
|
</B> <P>
|
|
1. Clarify that the existing LEAST-POSITIVE-XXX-FLOAT and<P>
|
|
LEAST-NEGATIVE-XXX-FLOAT constants are literally as defined, and<P>
|
|
therefore can be denormalized numbers in implementations that have<P>
|
|
denormalized numbers.<P>
|
|
<P>
|
|
2. Add the following constants, whose values are the normalized floating<P>
|
|
point numbers closest in value to (but not equal to) zero. In<P>
|
|
implementations that don't have denormalized numbers, the values of these<P>
|
|
constants are the same as the values of the other constants.<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/v_most_1.htm#least-negative-normalized-double-float"><B>LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT</B></A> [Constant]<P>
|
|
<A REL=DEFINITION HREF="../Body/v_most_1.htm#least-negative-normalized-long-float"><B>LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT</B></A> [Constant]<P>
|
|
<A REL=DEFINITION HREF="../Body/v_most_1.htm#least-negative-normalized-short-float"><B>LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT</B></A> [Constant]<P>
|
|
<A REL=DEFINITION HREF="../Body/v_most_1.htm#least-negative-normalized-single-float"><B>LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT</B></A> [Constant]<P>
|
|
<A REL=DEFINITION HREF="../Body/v_most_1.htm#least-positive-normalized-double-float"><B>LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT</B></A> [Constant]<P>
|
|
<A REL=DEFINITION HREF="../Body/v_most_1.htm#least-positive-normalized-long-float"><B>LEAST-POSITIVE-NORMALIZED-LONG-FLOAT</B></A> [Constant]<P>
|
|
<A REL=DEFINITION HREF="../Body/v_most_1.htm#least-positive-normalized-short-float"><B>LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT</B></A> [Constant]<P>
|
|
<A REL=DEFINITION HREF="../Body/v_most_1.htm#least-positive-normalized-single-float"><B>LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT</B></A> [Constant]<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
Regularize current practice.<P>
|
|
<P>
|
|
The ANSI Common Lisp <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> should be compatible with the widely used<P>
|
|
IEEE Floating Point <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A>.<P>
|
|
<P>
|
|
WITHOUT-FLOATING-UNDERFLOW-TRAPS is provided as a macro to allow<P>
|
|
implementation flexibility. It could expand into <A REL=DEFINITION HREF="../Body/m_handle.htm#handler-bind"><B>HANDLER-BIND</B></A> for<P>
|
|
<A REL=DEFINITION HREF="../Body/e_floa_3.htm#floating-point-underflow"><B>FLOATING-POINT-UNDERFLOW</B></A>, but in most implementations it will probably<P>
|
|
expand into implementation-dependent code that sets a hardware mode bit.<P>
|
|
<P>
|
|
Specifying "should signal" rather than "signals" or "might signal" for<P>
|
|
floating-point overflows and underflows seems the best balance between<P>
|
|
safety and implementation freedom. It wouldn't harm the proposal to<P>
|
|
change it to one of the other two phrases.<P>
|
|
<P>
|
|
<B>Current practice:<P>
|
|
</B><P>
|
|
Lucid and Symbolics implement this proposal.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
Small.<P>
|
|
<P>
|
|
If there are implementations that currently consider storing only<P>
|
|
normalized quantities in the CLtL-specified variables, code that<P>
|
|
references those variables might need to be changed to refer to the<P>
|
|
new variable so that the existing variables can be changed to store<P>
|
|
unnormalized values.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
Technically none. Portable code cannot rely on this feature because<P>
|
|
it is currently inadequately specified. Code which relies on a <P>
|
|
particular implementation's interpretation might have to be modified<P>
|
|
very slightly and recompiled.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
Continued confusion over the question of what is held by the<P>
|
|
existing LEAST-xxx variables.<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
None.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
Increased portability and correctness of floating point code.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
Neutral.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
Earlier revisions of this proposal addressed other features which <P>
|
|
addressed the issues raised in the Problem Description in a more <P>
|
|
thorough way. Included in version 3 was a proposal for a <P>
|
|
WITHOUT-FLOATING-UNDERFLOW-TRAPS form. Discussion of those <P>
|
|
additional features was tabled for lack of time during the meeting<P>
|
|
where the vote was taken on this issue--and a proposal equivalent<P>
|
|
to this more limited proposal was approved since it was less<P>
|
|
controversial.<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>
|