emacs.d/clones/lisp/HyperSpec-7-0/HyperSpec/Body/t_float.htm
2023-01-18 20:30:47 +01:00

55 lines
7.6 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: System Class FLOAT</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="t_real.htm">
<LINK REL=UP HREF="c_number.htm">
<LINK REL=NEXT HREF="t_short_.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="t_real.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="c_number.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="t_short_.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<A NAME="float"><I>System Class</I> <B>FLOAT</B></A> <P>
<P><B>Class Precedence List:</B><P>
<A REL=DEFINITION HREF="#float"><B>float</B></A>, <A REL=DEFINITION HREF="t_real.htm#real"><B>real</B></A>, <A REL=DEFINITION HREF="t_number.htm#number"><B>number</B></A>, <A REL=DEFINITION HREF="t_t.htm#t"><B>t</B></A> <P>
<P><B>Description:</B><P>
<P>
A <A REL=DEFINITION HREF="26_glo_f.htm#float"><I>float</I></A> is a mathematical rational (but <I>not</I> a Common Lisp <A REL=DEFINITION HREF="26_glo_r.htm#rational"><I>rational</I></A>) of the form s*f*b^e-p, where s is +1 or -1, the <I>sign</I>; b is an <A REL=DEFINITION HREF="26_glo_i.htm#integer"><I>integer</I></A> greater than 1, the <I>base</I> or <I>radix</I> of the representation; p is a positive <A REL=DEFINITION HREF="26_glo_i.htm#integer"><I>integer</I></A>, the <I>precision</I> (in base-b digits) of the <A REL=DEFINITION HREF="26_glo_f.htm#float"><I>float</I></A>; f is a positive <A REL=DEFINITION HREF="26_glo_i.htm#integer"><I>integer</I></A> between b^p-1 and b^p-1 (inclusive), the significand; and e is an <A REL=DEFINITION HREF="26_glo_i.htm#integer"><I>integer</I></A>, the exponent. The value of p and the range of e depends on the implementation and on the type of <A REL=DEFINITION HREF="26_glo_f.htm#float"><I>float</I></A> within that implementation. In addition, there is a floating-point zero; depending on the implementation, there can also be a ``minus zero''. If there is no minus zero, then 0.0 and -0.0 are both interpreted as simply a floating-point zero. <TT>(= 0.0 -0.0)</TT> is always true. If there is a minus zero, <TT>(eql -0.0 0.0)</TT> is <A REL=DEFINITION HREF="26_glo_f.htm#false"><I>false</I></A>, otherwise it is <A REL=DEFINITION HREF="26_glo_t.htm#true"><I>true</I></A>. <P>
<P>
<P>
The <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>types</I></A> <A REL=DEFINITION HREF="t_short_.htm#short-float"><B>short-float</B></A>, <A REL=DEFINITION HREF="t_short_.htm#single-float"><B>single-float</B></A>, <A REL=DEFINITION HREF="t_short_.htm#double-float"><B>double-float</B></A>, and <A REL=DEFINITION HREF="t_short_.htm#long-float"><B>long-float</B></A> are <A REL=DEFINITION HREF="26_glo_s.htm#subtype"><I>subtypes</I></A> of <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="#float"><B>float</B></A>. Any two of them must be either <A REL=DEFINITION HREF="26_glo_d.htm#disjoint"><I>disjoint</I></A> <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>types</I></A> or the <A REL=DEFINITION HREF="26_glo_s.htm#same"><I>same</I></A> <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A>; if the <A REL=DEFINITION HREF="26_glo_s.htm#same"><I>same</I></A> <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A>, then any other <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>types</I></A> between them in the above ordering must also be the <A REL=DEFINITION HREF="26_glo_s.htm#same"><I>same</I></A> <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A>. For example, if the <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="t_short_.htm#single-float"><B>single-float</B></A> and the <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="t_short_.htm#long-float"><B>long-float</B></A> are the <A REL=DEFINITION HREF="26_glo_s.htm#same"><I>same</I></A> <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A>, then the <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="t_short_.htm#double-float"><B>double-float</B></A> must be the <A REL=DEFINITION HREF="26_glo_s.htm#same"><I>same</I></A> <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> also. <P>
<P><B>Compound Type Specifier Kind:</B><P>
<P>
Abbreviating. <P>
<P><B>Compound Type Specifier Syntax:</B><P>
<P>
<B>float</B> <I></I>[<I>lower-limit </I>[<I>upper-limit</I>]<I></I>]<I></I><P>
<P>
<P><B>Compound Type Specifier Arguments:</B><P>
<P>
<I>lower-limit</I>, <I>upper-limit</I>---<A REL=DEFINITION HREF="26_glo_i.htm#interval_designator"><I>interval designators</I></A> for <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="#float"><B>float</B></A>. The defaults for each of <I>lower-limit</I> and <I>upper-limit</I> is the <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> <A REL=DEFINITION HREF="a_st.htm#ST"><B>*</B></A>. <P>
<P><B>Compound Type Specifier Description:</B><P>
<P>
This denotes the <A REL=DEFINITION HREF="26_glo_f.htm#float"><I>floats</I></A> on the interval described by <I>lower-limit</I> and <I>upper-limit</I>. <P>
<P><B>See Also:</B><P>
<P>
<A REL=DEFINITION HREF="02_ca.htm#syntaxfornumerictokens">Figure 2-9</A>, <A REL=CHILD HREF="02_cb.htm">Section 2.3.2 (Constructing Numbers from Tokens)</A>, <A REL=CHILD HREF="22_acac.htm">Section 22.1.3.1.3 (Printing Floats)</A> <P>
<P><B>Notes:</B><P>
<P>
Note that all mathematical integers are representable not only as Common Lisp <I>reals</I>, but also as <A REL=DEFINITION HREF="26_glo_c.htm#complex_float"><I>complex floats</I></A>. For example, possible representations of the mathematical number 1 include the <A REL=DEFINITION HREF="26_glo_i.htm#integer"><I>integer</I></A> <TT>1</TT>, the <A REL=DEFINITION HREF="26_glo_f.htm#float"><I>float</I></A> <TT>1.0</TT>, or the <A REL=DEFINITION HREF="26_glo_c.htm#complex"><I>complex</I></A> <TT>#C(1.0 0.0)</TT>. <P>
<P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issue</A>, <I>not part of the specification</I>, applies to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss290.htm">REAL-NUMBER-TYPE:X3J13-MAR-89</A><P></UL><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>