1
0
Fork 0
cl-sites/lisp-docs.github.io/cl-language-reference/chap-12/bc-b-number-concepts.html

172 lines
80 KiB
HTML
Raw Normal View History

2024-03-13 23:00:32 +01:00
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-chap-12/bc-b-number-concepts" data-has-hydrated="false">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v3.0.1">
<title data-rh="true">12.1 Number Concepts | Common Lisp (New) Language Reference</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://lisp-docs.github.io/cl-language-reference/img/1024px-Lisp_logo.svg.png"><meta data-rh="true" name="twitter:image" content="https://lisp-docs.github.io/cl-language-reference/img/1024px-Lisp_logo.svg.png"><meta data-rh="true" property="og:url" content="https://lisp-docs.github.io/cl-language-reference/chap-12/bc-b-number-concepts"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="google-site-verification" content="Vzaw013_bfdKeUVG89Ch3W1zC9_vH9ID2dPB9Dz0vr0"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="12.1 Number Concepts | Common Lisp (New) Language Reference"><meta data-rh="true" name="description" content="12.1.1 Numeric Operations"><meta data-rh="true" property="og:description" content="12.1.1 Numeric Operations"><link data-rh="true" rel="icon" href="../img/favicon.ico"><link data-rh="true" rel="canonical" href="bc-b-number-concepts.html"><link data-rh="true" rel="alternate" href="bc-b-number-concepts.html" hreflang="en"><link data-rh="true" rel="alternate" href="bc-b-number-concepts.html" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://C1F2Q5VM6X-dsn.algolia.net" crossorigin="anonymous"><link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-8TJCE4NSF8"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-8TJCE4NSF8",{})</script>
<link rel="search" type="application/opensearchdescription+xml" title="Common Lisp (New) Language Reference" href="../opensearch.xml"><link rel="stylesheet" href="../assets/css/styles.f13b59fe.css">
<script src="../assets/js/runtime~main.02699c25.js" defer="defer"></script>
<script src="../assets/js/main.4f0a7a76.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const c=new URLSearchParams(window.location.search).entries();for(var[t,e]of c)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><div id="__docusaurus"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="bc-b-number-concepts.html#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="../../index.html" target="_blank" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="../img/logo.svg" alt="Lisp Logo" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="../img/logo.svg" alt="Lisp Logo" class="themedComponent_mlkZ themedComponent--dark_xIcU"></div><b class="navbar__title text--truncate">Common Lisp Docs</b></a><a href="../../docs/tutorial/index.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Tutorial</a><a href="../index.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Technical Reference</a><a href="../../docs/whylisp.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Why Lisp?</a><a href="../../docs/howto.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Guides</a></div><div class="navbar__items navbar__items--right"><a href="../../docs/contribute.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Contribute!</a><a href="../../docs/help.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Getting Help</a><a href="../../docs/about.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">About</a><a href="../../blog.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Blog</a><a href="https://github.com/lisp-docs" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="toggle_vylO colorModeToggle_DEke"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.9
<!-- -->
<!-- -->
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="1211-numeric-operations">12.1.1 Numeric Operations<a href="bc-b-number-concepts.html#1211-numeric-operations" class="hash-link" aria-label="Direct link to 12.1.1 Numeric Operations" title="Direct link to 12.1.1 Numeric Operations"></a></h2>
<!-- -->
<p>Common Lisp provides a large variety of operations related to <span><i>numbers</i></span>. This section provides an overview of those operations by grouping them into categories that emphasize some of the relationships among them.</p>
<p>Figure 121 shows <span><i>operators</i></span> relating to arithmetic operations.</p>
<p>|</p><p><strong>* 1+ gcd</strong> </p><p><strong>+ 1- incf</strong> </p><p><strong>- conjugate lcm</strong> </p><p><strong>/ decf</strong></p>|<p></p>
<p>| :- |</p>
<p><strong>Figure 121. Operators relating to Arithmetic.</strong></p>
<p>Figure 122 shows <span><i>defined names</i></span> relating to exponential, logarithmic, and trigonometric operations.</p>
<p>|</p><p><strong>abs cos signum</strong> </p><p><strong>acos cosh sin</strong> </p><p><strong>acosh exp sinh</strong> </p><p><strong>asin expt sqrt</strong> </p><p><strong>asinh isqrt tan</strong> </p><p><strong>atan log tanh</strong> </p><p><strong>atanh phase</strong> </p><p><strong>cis pi</strong></p>|<p></p>
<p>| :- |</p>
<p><strong>Figure 122. Defined names relating to Exponentials, Logarithms, and Trigonometry.</strong> Figure 123 shows <span><i>operators</i></span> relating to numeric comparison and predication.</p>
<p>|</p><p><span><b>/=</b></span> &gt;<strong>= oddp</strong> </p><p>&lt; <strong>evenp plusp</strong> </p><p>&lt;<strong>= max zerop</strong> </p><p><strong>= min</strong> </p><p>&gt; <span><b>minusp</b></span></p>|<p></p>
<p>| :- |</p>
<p><strong>Figure 123. Operators for numeric comparison and predication.</strong></p>
<p>Figure 124 shows <span><i>defined names</i></span> relating to numeric type manipulation and coercion.</p>
<p>|</p><p><strong>ceiling float-radix rational</strong> </p><p><strong>complex float-sign rationalize decode-float floor realpart</strong> </p><p><strong>denominator fround rem</strong> </p><p><strong>fceiling ftruncate round</strong> </p><p><strong>ffloor imagpart scale-float float integer-decode-float truncate</strong> </p><p><strong>float-digits mod</strong> </p><p><strong>float-precision numerator</strong></p>|<p></p>
<p>| :- |</p>
<p><strong>Figure 124. Defined names relating to numeric type manipulation and coercion.</strong></p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12111-associativity-and-commutativity-in-numeric-operations">12.1.1.1 Associativity and Commutativity in Numeric Operations<a href="bc-b-number-concepts.html#12111-associativity-and-commutativity-in-numeric-operations" class="hash-link" aria-label="Direct link to 12.1.1.1 Associativity and Commutativity in Numeric Operations" title="Direct link to 12.1.1.1 Associativity and Commutativity in Numeric Operations"></a></h3>
<!-- -->
<p>For functions that are mathematically associative (and possibly commutative), a <span><i>conforming implementation</i></span> may process the <span><i>arguments</i></span> in any manner consistent with associative (and possibly commutative) rearrangement. This does not affect the order in which the <span><i>argument</i></span></p>
<p><span><i>forms</i></span> are <em>evaluated</em>; for a discussion of evaluation order, see Section 3.1.2.1.2.3 (Function Forms). What is unspecified is only the order in which the <em>parameter values</em> are processed. This implies that <span><i>implementations</i></span> may differ in which automatic <em>coercions</em> are applied; see Section 12.1.1.2 (Contagion in Numeric Operations).</p>
<p>A <span><i>conforming program</i></span> can control the order of processing explicitly by separating the operations into separate (possibly nested) <span><i>function forms</i></span>, or by writing explicit calls to <span><i>functions</i></span> that perform coercions.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="121111-examples-of-associativity-and-commutativity-in-numeric-operations">12.1.1.1.1 Examples of Associativity and Commutativity in Numeric Operations<a href="bc-b-number-concepts.html#121111-examples-of-associativity-and-commutativity-in-numeric-operations" class="hash-link" aria-label="Direct link to 12.1.1.1.1 Examples of Associativity and Commutativity in Numeric Operations" title="Direct link to 12.1.1.1.1 Examples of Associativity and Commutativity in Numeric Operations"></a></h4>
<!-- -->
<div class="language-lisp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-lisp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">Consider the following expression, in which we assume that </span><span class="token number" style="color:#36acaa">1.0</span><span class="token plain"> and 1.0e-15 both denote *single floats*: </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">+</span><span class="token plain"> 1/3 2/3 1.0d0 </span><span class="token number" style="color:#36acaa">1.0</span><span class="token plain"> 1.0e-15</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">One *conforming implementation* might process the *arguments* from left to right, first adding 1/3 and 2/3 to get 1, then converting that to a *double float* for combination with 1.0d0, then successively converting and adding </span><span class="token number" style="color:#36acaa">1.0</span><span class="token plain"> and 1.0e-15. </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Another *conforming implementation* might process the *arguments* from right to left, first performing a *single float* addition of </span><span class="token number" style="color:#36acaa">1.0</span><span class="token plain"> and 1.0e-15 </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">perhaps</span><span class="token plain"> losing accuracy in the process</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain">, then converting the sum to a *double float* and adding 1.0d0, then converting 2/3 to a *double float* and adding it, and then converting 1/3 and adding that. </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">A third *conforming implementation* might first scan all the *arguments*, process all the *rationals* first to keep that part of the computation exact, then find an *argument* of the largest floating-point </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">format among all the *arguments* and add that, and then add in all other *arguments*, converting each in turn </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">all</span><span class="token plain"> in a perhaps misguided attempt to make the computation as accurate as possible</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain">. </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">In any case, all three strategies are legitimate. </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">A *conforming program* could control the order by writing, for example, </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">+</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">+</span><span class="token plain"> 1/3 2/3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">+</span><span class="token plain"> 1.0d0 1.0e-15</span><span class="token punctuation" style="color:#393A34">)</span><span class="to
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12112-contagion-in-numeric-operations">12.1.1.2 Contagion in Numeric Operations<a href="bc-b-number-concepts.html#12112-contagion-in-numeric-operations" class="hash-link" aria-label="Direct link to 12.1.1.2 Contagion in Numeric Operations" title="Direct link to 12.1.1.2 Contagion in Numeric Operations"></a></h3>
<!-- -->
<p>For information about the contagion rules for implicit coercions of <span><i>arguments</i></span> in numeric operations, see Section 12.1.4.4 (Rule of Float Precision Contagion), Section 12.1.4.1 (Rule of Float and Rational Contagion), and Section 12.1.5.2 (Rule of Complex Contagion).</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12113-viewing-integers-as-bits-and-bytes">12.1.1.3 Viewing Integers as Bits and Bytes<a href="bc-b-number-concepts.html#12113-viewing-integers-as-bits-and-bytes" class="hash-link" aria-label="Direct link to 12.1.1.3 Viewing Integers as Bits and Bytes" title="Direct link to 12.1.1.3 Viewing Integers as Bits and Bytes"></a></h3>
<!-- -->
<!-- -->
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="121131-logical-operations-on-integers">12.1.1.3.1 Logical Operations on Integers<a href="bc-b-number-concepts.html#121131-logical-operations-on-integers" class="hash-link" aria-label="Direct link to 12.1.1.3.1 Logical Operations on Integers" title="Direct link to 12.1.1.3.1 Logical Operations on Integers"></a></h4>
<!-- -->
<p>Logical operations require <em>integers</em> as arguments; an error of <span><i>type</i></span> <span><b>type-error</b></span> should be signaled if an argument is supplied that is not an <em>integer</em> . <em>Integer</em> arguments to logical operations are treated as if they were represented in twos-complement notation.</p>
<p>Figure 125 shows <span><i>defined names</i></span> relating to logical operations on numbers.</p>
<p>|</p><p><strong>ash boole-ior logbitp</strong> </p><p><strong>boole boole-nand logcount</strong> </p><p><strong>boole-1 boole-nor logeqv</strong> </p><p><strong>boole-2 boole-orc1 logior</strong> </p><p><strong>boole-and boole-orc2 lognand</strong> </p><p><strong>boole-andc1 boole-set lognor</strong> </p><p><strong>boole-andc2 boole-xor lognot</strong> </p><p><strong>boole-c1 integer-length logorc1</strong> </p><p><strong>boole-c2 logand logorc2</strong> </p><p><strong>boole-clr logandc1 logtest</strong> </p><p><strong>boole-eqv logandc2 logxor</strong></p>|<p></p>
<p>| :- |</p>
<p><strong>Figure 125. Defined names relating to logical operations on numbers.</strong></p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="121132-byte-operations-on-integers">12.1.1.3.2 Byte Operations on Integers<a href="bc-b-number-concepts.html#121132-byte-operations-on-integers" class="hash-link" aria-label="Direct link to 12.1.1.3.2 Byte Operations on Integers" title="Direct link to 12.1.1.3.2 Byte Operations on Integers"></a></h4>
<!-- -->
<p>The byte-manipulation <span><i>functions</i></span> use <span><i>objects</i></span> called <span><i>byte specifiers</i></span> to designate the size and position of a specific <span><i>byte</i></span> within an <em>integer</em> . The representation of a <span><i>byte specifier</i></span> is <em>implementation dependent</em>; it might or might not be a <span><i>number</i></span> . The <span><i>function</i></span> <span><b>byte</b></span> will construct a <span><i>byte specifier</i></span> , which various other byte-manipulation <span><i>functions</i></span> will accept.</p>
<p>Figure 126 shows <span><i>defined names</i></span> relating to manipulating <span><i>bytes</i></span> of <span><i>numbers</i></span>.</p>
<p>|</p><p><strong>byte deposit-field ldb-test</strong> </p><p><strong>byte-position dpb mask-field</strong> </p><p><strong>byte-size ldb</strong></p>|<p></p>
<p>| :- |</p>
<p><strong>Figure 126. Defined names relating to byte manipulation.</strong></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="1212-implementation">12.1.2 Implementation<a href="bc-b-number-concepts.html#1212-implementation" class="hash-link" aria-label="Direct link to 12.1.2 Implementation" title="Direct link to 12.1.2 Implementation"></a></h2>
<!-- -->
<p>Figure 127 shows <span><i>defined names</i></span> relating to <span><i>implementation-dependent</i></span> details about <span><i>numbers</i></span>.</p>
<p>|</p><p><strong>double-float-epsilon most-negative-fixnum</strong> </p><p><strong>double-float-negative-epsilon most-negative-long-float</strong> </p><p><strong>least-negative-double-float most-negative-short-float</strong> </p><p><strong>least-negative-long-float most-negative-single-float</strong> </p><p><strong>least-negative-short-float most-positive-double-float</strong> </p><p><strong>least-negative-single-float most-positive-fixnum</strong> </p><p><strong>least-positive-double-float most-positive-long-float</strong> </p><p><strong>least-positive-long-float most-positive-short-float</strong> </p><p><strong>least-positive-short-float most-positive-single-float</strong> </p><p><strong>least-positive-single-float short-float-epsilon</strong> </p><p><strong>long-float-epsilon short-float-negative-epsilon long-float-negative-epsilon single-float-epsilon</strong> </p><p><strong>most-negative-double-float single-float-negative-epsilon</strong></p>|<p></p>
<p>| :- |</p>
<p><strong>Figure 127. Defined names relating to implementation-dependent details about numbers.</strong></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="1213-rational-computations">12.1.3 Rational Computations<a href="bc-b-number-concepts.html#1213-rational-computations" class="hash-link" aria-label="Direct link to 12.1.3 Rational Computations" title="Direct link to 12.1.3 Rational Computations"></a></h2>
<!-- -->
<p>The rules in this section apply to <span><i>rational</i></span> computations.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12131-rule-of-unbounded-rational-precision">12.1.3.1 Rule of Unbounded Rational Precision<a href="bc-b-number-concepts.html#12131-rule-of-unbounded-rational-precision" class="hash-link" aria-label="Direct link to 12.1.3.1 Rule of Unbounded Rational Precision" title="Direct link to 12.1.3.1 Rule of Unbounded Rational Precision"></a></h3>
<!-- -->
<p>Rational computations cannot overflow in the usual sense (though there may not be enough storage to represent a result), since <em>integers</em> and <span><i>ratios</i></span> may in principle be of any magnitude.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12132-rule-of-canonical-representation-for-rationals">12.1.3.2 Rule of Canonical Representation for Rationals<a href="bc-b-number-concepts.html#12132-rule-of-canonical-representation-for-rationals" class="hash-link" aria-label="Direct link to 12.1.3.2 Rule of Canonical Representation for Rationals" title="Direct link to 12.1.3.2 Rule of Canonical Representation for Rationals"></a></h3>
<!-- -->
<p>If any computation produces a result that is a mathematical ratio of two integers such that the denominator evenly divides the numerator, then the result is converted to the equivalent <em>integer</em> .</p>
<p>If the denominator does not evenly divide the numerator, the canonical representation of a <span><i>rational</i></span> number is as the <span><i>ratio</i></span> that numerator and that denominator, where the greatest common divisor of the numerator and denominator is one, and where the denominator is positive and greater than one.</p>
<p>When used as input (in the default syntax), the notation -0 always denotes the <em>integer</em> 0. A <span><i>conforming implementation</i></span> must not have a representation of “minus zero” for <em>integers</em> that is distinct from its representation of zero for <em>integers</em>. However, such a distinction is possible for <span><i>floats</i></span>; see the <span><i>type</i></span> <span><b>float</b></span>.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12133-rule-of-float-substitutability">12.1.3.3 Rule of Float Substitutability<a href="bc-b-number-concepts.html#12133-rule-of-float-substitutability" class="hash-link" aria-label="Direct link to 12.1.3.3 Rule of Float Substitutability" title="Direct link to 12.1.3.3 Rule of Float Substitutability"></a></h3>
<!-- -->
<p>When the arguments to an irrational mathematical <span><i>function</i></span> are all <span><i>rational</i></span> and the true mathe matical result is also (mathematically) rational, then unless otherwise noted an implementation is free to return either an accurate <span><i>rational</i></span> result or a <span><i>single float</i></span> approximation. If the arguments</p>
<p>are all <span><i>rational</i></span> but the result cannot be expressed as a <span><i>rational</i></span> number, then a <span><i>single float</i></span> approximation is always returned.</p>
<p>If the arguments to an irrational mathematical <span><i>function</i></span> are all of type</p>
<p>(or rational (complex rational)) and the true mathematical result is (mathematically) a complex number with rational real and imaginary parts, then unless otherwise noted an imple mentation is free to return either an accurate result of type (or rational (complex rational)) or a <span><i>single float</i></span> (permissible only if the imaginary part of the true mathematical result is zero) or (complex single-float). If the arguments are all of type (or rational (complex rational)) but the result cannot be expressed as a <span><i>rational</i></span> or <span><i>complex rational</i></span>, then the returned value will be of <span><i>type</i></span> <span><b>single-float</b></span> (permissible only if the imaginary part of the true mathematical result is zero) or (complex single-float).</p>
<p>Float substitutability applies neither to the rational <span><i>functions</i></span> <span><b>+</b></span>, <span><b>-</b></span>, <strong>*</strong>, and <span><b>/</b></span> nor to the related <span><i>operators</i></span> <span><b>1+</b></span>, <strong>1-</strong>, <span><b>incf</b></span>, <span><b>decf</b></span>, and <span><b>conjugate</b></span>. For rational <span><i>functions</i></span>, if all arguments are <span><i>rational</i></span>, then the result is <span><i>rational</i></span>; if all arguments are of type (or rational (complex rational)), then the result is of type (or rational (complex rational)).</p>
<p>|<strong>Function Sample Results</strong>|</p>
<p>| :- |</p>
<p>|</p><p><span><b>abs</b></span> (abs #c(3 4)) → 5 <em>or</em> 5.0 </p><p><span><b>acos</b></span> (acos 1) → 0 <em>or</em> 0.0 </p><p><span><b>acosh</b></span> (acosh 1) → 0 <em>or</em> 0.0 </p><p><span><b>asin</b></span> (asin 0) → 0 <em>or</em> 0.0 </p><p><span><b>asinh</b></span> (asinh 0) → 0 <em>or</em> 0.0 </p><p><span><b>atan</b></span> (atan 0) → 0 <em>or</em> 0.0 </p><p><span><b>atanh</b></span> (atanh 0) → 0 <em>or</em> 0.0 </p><p><span><b>cis</b></span> (cis 0) → 1 <em>or</em> #c(1.0 0.0) </p><p><span><b>cos</b></span> (cos 0) → 1 <em>or</em> 1.0 </p><p><span><b>cosh</b></span> (cosh 0) → 1 <em>or</em> 1.0 </p><p><span><b>exp</b></span> (exp 0) → 1 <em>or</em> 1.0 </p><p><span><b>expt</b></span> (expt 8 1/3) → 2 <em>or</em> 2.0 </p><p><span><b>log</b></span> (log 1) → 0 <em>or</em> 0.0 </p><p>(log 8 2) → 3 <em>or</em> 3.0 </p><p><span><b>phase</b></span> (phase 7) → 0 <em>or</em> 0.0 </p><p><span><b>signum</b></span> (signum #c(3 4)) → #c(3/5 4/5) <em>or</em> #c(0.6 0.8) <span><b>sin</b></span> (sin 0) → 0 <em>or</em> 0.0 </p><p><span><b>sinh</b></span> (sinh 0) → 0 <em>or</em> 0.0 </p><p><span><b>sqrt</b></span> (sqrt 4) → 2 <em>or</em> 2.0 </p><p>(sqrt 9/16) → 3/4 <em>or</em> 0.75 </p><p><span><b>tan</b></span> (tan 0) → 0 <em>or</em> 0.0 </p><p><span><b>tanh</b></span> (tanh 0) → 0 <em>or</em> 0.0</p>|<p></p>
<p><strong>Figure 128. Functions Affected by Rule of Float Substitutability</strong></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="1214-floating">12.1.4 Floating<a href="bc-b-number-concepts.html#1214-floating" class="hash-link" aria-label="Direct link to 12.1.4 Floating" title="Direct link to 12.1.4 Floating"></a></h2>
<!-- -->
<p>The following rules apply to floating point computations.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12141-rule-of-float-and-rational-contagion">12.1.4.1 Rule of Float and Rational Contagion<a href="bc-b-number-concepts.html#12141-rule-of-float-and-rational-contagion" class="hash-link" aria-label="Direct link to 12.1.4.1 Rule of Float and Rational Contagion" title="Direct link to 12.1.4.1 Rule of Float and Rational Contagion"></a></h3>
<!-- -->
<p>When <span><i>rationals</i></span> and <span><i>floats</i></span> are combined by a numerical function, the <span><i>rational</i></span> is first converted to a <span><i>float</i></span> of the same format. For <span><i>functions</i></span> such as <span><b>+</b></span> that take more than two arguments, it is permitted that part of the operation be carried out exactly using <span><i>rationals</i></span> and the rest be done using floating-point arithmetic.</p>
<p>When <span><i>rationals</i></span> and <span><i>floats</i></span> are compared by a numerical function, the <span><i>function</i></span> <span><b>rational</b></span> is effectively called to convert the <span><i>float</i></span> to a <span><i>rational</i></span> and then an exact comparison is performed. In the case of <span><i>complex</i></span> numbers, the real and imaginary parts are effectively handled individually.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="121411-examples-of-rule-of-float-and-rational-contagion">12.1.4.1.1 Examples of Rule of Float and Rational Contagion<a href="bc-b-number-concepts.html#121411-examples-of-rule-of-float-and-rational-contagion" class="hash-link" aria-label="Direct link to 12.1.4.1.1 Examples of Rule of Float and Rational Contagion" title="Direct link to 12.1.4.1.1 Examples of Rule of Float and Rational Contagion"></a></h4>
<!-- -->
<div class="language-lisp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-lisp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token heading comment title" style="color:#999988;font-style:italic">;;;; Combining rationals with floats. </span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token heading comment title" style="color:#999988;font-style:italic">;;; This example assumes an implementation in which </span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token heading comment title" style="color:#999988;font-style:italic">;;; (float-radix 0.5) is 2 (as in IEEE) or 16 (as in IBM/360), </span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token heading comment title" style="color:#999988;font-style:italic">;;; or else some other implementation in which 1/2 has an exact </span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token heading comment title" style="color:#999988;font-style:italic">;;; representation in floating point. </span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">+</span><span class="token plain"> 1/2 </span><span class="token number" style="color:#36acaa">0.5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><span class="token number" style="color:#36acaa">1.0</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">-</span><span class="token plain"> 1/2 0.5d0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> → 0.0d0 </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">+</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.5</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">-0.5</span><span class="token plain"> 1/2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><span class="token number" style="color:#36acaa">0.5</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token heading comment title" style="color:#999988;font-style:italic">;;;; Comparing rationals with floats. </span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token heading comment title" style="color:#999988;font-style:italic">;;; This example assumes an implementation in which the default float </span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token heading comment title" style="color:#999988;font-style:italic">;;; format is IEEE single-float, IEEE double-float, or some other format </span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token heading comment title" style="color:#999988;font-style:italic">;;; in which 5/7 is rounded upwards by FLOAT. </span><span class="token plain"></span><
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12142-rule-of-float-approximation">12.1.4.2 Rule of Float Approximation<a href="bc-b-number-concepts.html#12142-rule-of-float-approximation" class="hash-link" aria-label="Direct link to 12.1.4.2 Rule of Float Approximation" title="Direct link to 12.1.4.2 Rule of Float Approximation"></a></h3>
<!-- -->
<p>Computations with <span><i>floats</i></span> are only approximate, although they are described as if the results were mathematically accurate. Two mathematically identical expressions may be computationally different because of errors inherent in the floating-point approximation process. The precision of a <span><i>float</i></span> is not necessarily correlated with the accuracy of that number. For instance, 3.142857142857142857 is a more precise approximation to <em>π</em> than 3.14159, but the latter is more accurate. The precision refers to the number of bits retained in the representation. When an operation combines a <span><i>short float</i></span> with a <span><i>long float</i></span>, the result will be a <span><i>long float</i></span>. Common Lisp functions assume that the accuracy of arguments to them does not exceed their precision. Therefore when two <em>small floats</em> are combined, the result is a <em>small float</em>. Common Lisp functions never convert automatically from a larger size to a smaller one.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12143-rule-of-float-underflow-and-overflow">12.1.4.3 Rule of Float Underflow and Overflow<a href="bc-b-number-concepts.html#12143-rule-of-float-underflow-and-overflow" class="hash-link" aria-label="Direct link to 12.1.4.3 Rule of Float Underflow and Overflow" title="Direct link to 12.1.4.3 Rule of Float Underflow and Overflow"></a></h3>
<!-- -->
<p>An error of <span><i>type</i></span> <span><b>floating-point-overflow</b></span> or <span><b>floating-point-underflow</b></span> should be signaled if a floating-point computation causes exponent overflow or underflow, respectively.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12144-rule-of-float-precision-contagion">12.1.4.4 Rule of Float Precision Contagion<a href="bc-b-number-concepts.html#12144-rule-of-float-precision-contagion" class="hash-link" aria-label="Direct link to 12.1.4.4 Rule of Float Precision Contagion" title="Direct link to 12.1.4.4 Rule of Float Precision Contagion"></a></h3>
<!-- -->
<p>The result of a numerical function is a <span><i>float</i></span> of the largest format among all the floating-point arguments to the <span><i>function</i></span>.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="1215-complex-computations">12.1.5 Complex Computations<a href="bc-b-number-concepts.html#1215-complex-computations" class="hash-link" aria-label="Direct link to 12.1.5 Complex Computations" title="Direct link to 12.1.5 Complex Computations"></a></h2>
<!-- -->
<p>The following rules apply to <span><i>complex</i></span> computations:</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12151-rule-of-complex-substitutability">12.1.5.1 Rule of Complex Substitutability<a href="bc-b-number-concepts.html#12151-rule-of-complex-substitutability" class="hash-link" aria-label="Direct link to 12.1.5.1 Rule of Complex Substitutability" title="Direct link to 12.1.5.1 Rule of Complex Substitutability"></a></h3>
<!-- -->
<p>Except during the execution of irrational and transcendental <span><i>functions</i></span>, no numerical <span><i>function</i></span> ever <span><i>yields</i></span> a <span><i>complex</i></span> unless one or more of its <span><i>arguments</i></span> is a <span><i>complex</i></span> .</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12152-rule-of-complex-contagion">12.1.5.2 Rule of Complex Contagion<a href="bc-b-number-concepts.html#12152-rule-of-complex-contagion" class="hash-link" aria-label="Direct link to 12.1.5.2 Rule of Complex Contagion" title="Direct link to 12.1.5.2 Rule of Complex Contagion"></a></h3>
<!-- -->
<p>When a <em>real</em> and a <span><i>complex</i></span> are both part of a computation, the <em>real</em> is first converted to a <span><i>complex</i></span> by providing an imaginary part of 0.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12153-rule-of-canonical-representation-for-complex-rationals">12.1.5.3 Rule of Canonical Representation for Complex Rationals<a href="bc-b-number-concepts.html#12153-rule-of-canonical-representation-for-complex-rationals" class="hash-link" aria-label="Direct link to 12.1.5.3 Rule of Canonical Representation for Complex Rationals" title="Direct link to 12.1.5.3 Rule of Canonical Representation for Complex Rationals"></a></h3>
<!-- -->
<p>If the result of any computation would be a <span><i>complex</i></span> number whose real part is of <span><i>type</i></span> <span><b>rational</b></span> and whose imaginary part is zero, the result is converted to the <span><i>rational</i></span> which is the real part. This rule does not apply to <span><i>complex</i></span> numbers whose parts are <span><i>floats</i></span>. For example, #C(5 0) and 5 are not <em>different objects</em> in Common Lisp(they are always the <span><i>same</i></span> under <span><b>eql</b></span>); #C(5.0 0.0) and</p>
<p>5.0 are always <em>different objects</em> in Common Lisp (they are never the <span><i>same</i></span> under <span><b>eql</b></span>, although they are the <span><i>same</i></span> under <span><b>equalp</b></span> and <span><b>=</b></span>).</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="121531-examples-of-rule-of-canonical-representation-for-complex-rationals">12.1.5.3.1 Examples of Rule of Canonical Representation for Complex Rationals<a href="bc-b-number-concepts.html#121531-examples-of-rule-of-canonical-representation-for-complex-rationals" class="hash-link" aria-label="Direct link to 12.1.5.3.1 Examples of Rule of Canonical Representation for Complex Rationals" title="Direct link to 12.1.5.3.1 Examples of Rule of Canonical Representation for Complex Rationals"></a></h4>
<!-- -->
<div class="language-lisp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-lisp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">#c</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1.0</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> → #C</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1.0</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">#c</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> → #C</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">#c</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1.0</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> → #C</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1.0</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">#c</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> → #C</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">#c</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> → #C</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">#c</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="12154-principal-values-and-branch-cuts">12.1.5.4 Principal Values and Branch Cuts<a href="bc-b-number-concepts.html#12154-principal-values-and-branch-cuts" class="hash-link" aria-label="Direct link to 12.1.5.4 Principal Values and Branch Cuts" title="Direct link to 12.1.5.4 Principal Values and Branch Cuts"></a></h3>
<!-- -->
<p>Many of the irrational and transcendental functions are multiply defined in the complex domain; for example, there are in general an infinite number of complex values for the logarithm function. In each such case, a <em>principal value</em> must be chosen for the function to return. In general, such values cannot be chosen so as to make the range continuous; lines in the domain called branch cuts must be defined, which in turn define the discontinuities in the range. Common Lisp defines the branch cuts, <em>principal values</em>, and boundary conditions for the complex functions following “Principal Values and Branch Cuts in Complex APL.” The branch cut rules that apply to each function are located with the description of that function.</p>
<p>Figure 129 lists the identities that are obeyed throughout the applicable portion of the complex domain, even on the branch cuts:</p>
<p>|sin i z = i sinh z sinh i z = i sin z arctan i z = i arctanh z cos i z = cosh z cosh i z = cos z arcsinh i z = i arcsin z tan i z = i tanh z arcsin i z = i arcsinh z arctanh i z = i arctan z|</p>
<p>| :- |</p>
<p><strong>Figure 129. Trigonometric Identities for Complex Domain</strong></p>
<p>The quadrant numbers referred to in the discussions of branch cuts are as illustrated in Figure 1210.</p>
<p>Positive</p>
<p>Imaginary Axis</p>
<p><sup>..</sup>.</p>
<p><sub>II</sub><sup>..</sup>. I</p>
<p>Negative Real Axis <em>· · · · · · · · · · · · · · · · · ·</em> Positive Real Axis</p>
<p><sub>III</sub><sup>..</sup>. IV</p>
<p><sup>..</sup>.</p>
<p>Negative</p>
<p>Imaginary Axis</p>
<p><strong>Figure 1210. Quadrant Numbering for Branch Cuts</strong></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="1216-interval-designators">12.1.6 Interval Designators<a href="bc-b-number-concepts.html#1216-interval-designators" class="hash-link" aria-label="Direct link to 12.1.6 Interval Designators" title="Direct link to 12.1.6 Interval Designators"></a></h2>
<!-- -->
<p>The <span><i>compound type specifier</i></span> form of the numeric <span><i>type specifiers</i></span> permit the user to specify an interval on the real number line which describe a <span><i>subtype</i></span> of the <span><i>type</i></span> which would be described by the corresponding <span><i>atomic type specifier</i></span> . A <span><i>subtype</i></span> of some <em>type T</em> is specified using an ordered pair of <span><i>objects</i></span> called <span><i>interval designators</i></span> for <em>type T</em>.</p>
<p>The first of the two <span><i>interval designators</i></span> for <em>type T</em> can be any of the following:</p>
<p>a number <em>N</em> of <em>type T</em></p>
<p>This denotes a lower inclusive bound of <em>N</em>. That is, <span><i>elements</i></span> of the <span><i>subtype</i></span> of <span><i>T</i></span> will be greater than or equal to <em>N</em>.</p>
<p>a <em>singleton list</em> whose <span><i>element</i></span> is a number <em>M</em> of <em>type T</em></p>
<p>This denotes a lower exclusive bound of <em>M</em>. That is, <span><i>elements</i></span> of the <span><i>subtype</i></span> of <span><i>T</i></span> will be greater than <em>M</em>.</p>
<p>the symbol <strong>*</strong></p>
<p>This denotes the absence of a lower bound on the interval.</p>
<p>The second of the two <span><i>interval designators</i></span> for <em>type T</em> can be any of the following:</p>
<p>a number <em>N</em> of <em>type T</em></p>
<p>This denotes an upper inclusive bound of <em>N</em>. That is, <span><i>elements</i></span> of the <span><i>subtype</i></span> of <span><i>T</i></span> will be less than or equal to <em>N</em>.</p>
<p>a <em>singleton list</em> whose <span><i>element</i></span> is a number <em>M</em> of <em>type T</em></p>
<p>This denotes an upper exclusive bound of <em>M</em>. That is, <span><i>elements</i></span> of the <span><i>subtype</i></span> of <span><i>T</i></span> will be less than <em>M</em>.</p>
<p>the symbol <strong>*</strong></p>
<p>This denotes the absence of an upper bound on the interval.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="1217-random">12.1.7 Random<a href="bc-b-number-concepts.html#1217-random" class="hash-link" aria-label="Direct link to 12.1.7 Random" title="Direct link to 12.1.7 Random"></a></h2>
<!-- -->
<!-- -->
<p>Figure 1211 lists some <span><i>defined names</i></span> that are applicable to <span><i>random states</i></span>.</p>
<p>|</p><p><strong>*random-state* random</strong> </p><p><strong>make-random-state random-state-p</strong></p>|<p></p>
<p>| :- |</p>
<p><strong>Figure 1211. Random-state defined names</strong></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/lisp-docs/cl-language-reference/tree/main/docs/chap-12/bc-b-number-concepts.md" target="_blank" rel="noopener noreferrer" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> by <b>daninus14</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="../chap-11/bb-c-dictionary/with-package-iterator_macro.html"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">with-package-iterator</div></a><a class="pagination-nav__link pagination-nav__link--next" href="../category/122-numbers-dictionary.html"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">12.2 Numbers Dictionary</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="bc-b-number-concepts.html#1211-numeric-operations" class="table-of-contents__link toc-highlight">12.1.1 Numeric Operations</a><ul><li><a href="bc-b-number-concepts.html#12111-associativity-and-commutativity-in-numeric-operations" class="table-of-contents__link toc-highlight">12.1.1.1 Associativity and Commutativity in Numeric Operations</a><ul><li><a href="bc-b-number-concepts.html#121111-examples-of-associativity-and-commutativity-in-numeric-operations" class="table-of-contents__link toc-highlight">12.1.1.1.1 Examples of Associativity and Commutativity in Numeric Operations</a></li></ul></li><li><a href="bc-b-number-concepts.html#12112-contagion-in-numeric-operations" class="table-of-contents__link toc-highlight">12.1.1.2 Contagion in Numeric Operations</a></li><li><a href="bc-b-number-concepts.html#12113-viewing-integers-as-bits-and-bytes" class="table-of-contents__link toc-highlight">12.1.1.3 Viewing Integers as Bits and Bytes</a><ul><li><a href="bc-b-number-concepts.html#121131-logical-operations-on-integers" class="table-of-contents__link toc-highlight">12.1.1.3.1 Logical Operations on Integers</a></li><li><a href="bc-b-number-concepts.html#121132-byte-operations-on-integers" class="table-of-contents__link toc-highlight">12.1.1.3.2 Byte Operations on Integers</a></li></ul></li></ul></li><li><a href="bc-b-number-concepts.html#1212-implementation" class="table-of-contents__link toc-highlight">12.1.2 Implementation</a></li><li><a href="bc-b-number-concepts.html#1213-rational-computations" class="table-of-contents__link toc-highlight">12.1.3 Rational Computations</a><ul><li><a href="bc-b-number-concepts.html#12131-rule-of-unbounded-rational-precision" class="table-of-contents__link toc-highlight">12.1.3.1 Rule of Unbounded Rational Precision</a></li><li><a href="bc-b-number-concepts.html#12132-rule-of-canonical-representation-for-rationals" class="table-of-contents__link toc-highlight">12.1.3.2 Rule of Canonical Representation for Rationals</a></li><li><a href="bc-b-number-concepts.html#12133-rule-of-float-substitutability" class="table-of-contents__link toc-highlight">12.1.3.3 Rule of Float Substitutability</a></li></ul></li><li><a href="bc-b-number-concepts.html#1214-floating" class="table-of-contents__link toc-highlight">12.1.4 Floating</a><ul><li><a href="bc-b-number-concepts.html#12141-rule-of-float-and-rational-contagion" class="table-of-contents__link toc-highlight">12.1.4.1 Rule of Float and Rational Contagion</a><ul><li><a href="bc-b-number-concepts.html#121411-examples-of-rule-of-float-and-rational-con
</body>
</html>