| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>Rule of Float and Rational Contagion (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="Rule of Float and Rational Contagion (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="Rule of Float and Rational Contagion (ANSI and GNU Common Lisp Document)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| 13 |
<link href="index.html" rel="start" title="Top"> |
| 14 |
<link href="Floating_002dpoint-Computations.html" rel="up" title="Floating-point Computations"> |
| 15 |
<link href="Examples-of-Rule-of-Float-and-Rational-Contagion.html" rel="next" title="Examples of Rule of Float and Rational Contagion"> |
| 16 |
<link href="Floating_002dpoint-Computations.html" rel="prev" title="Floating-point Computations"> |
| 17 |
<style type="text/css"> |
| 18 |
<!-- |
| 19 |
a.summary-letter {text-decoration: none} |
| 20 |
blockquote.indentedblock {margin-right: 0em} |
| 21 |
div.display {margin-left: 3.2em} |
| 22 |
div.example {margin-left: 3.2em} |
| 23 |
div.lisp {margin-left: 3.2em} |
| 24 |
kbd {font-style: oblique} |
| 25 |
pre.display {font-family: inherit} |
| 26 |
pre.format {font-family: inherit} |
| 27 |
pre.menu-comment {font-family: serif} |
| 28 |
pre.menu-preformatted {font-family: serif} |
| 29 |
span.nolinebreak {white-space: nowrap} |
| 30 |
span.roman {font-family: initial; font-weight: normal} |
| 31 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| 32 |
ul.no-bullet {list-style: none} |
| 33 |
--> |
| 34 |
</style> |
| 35 |
|
| 36 |
|
| 37 |
</head> |
| 38 |
|
| 39 |
<body lang="en"> |
| 40 |
<span id="Rule-of-Float-and-Rational-Contagion"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="Examples-of-Rule-of-Float-and-Rational-Contagion.html" accesskey="n" rel="next">Examples of Rule of Float and Rational Contagion</a>, Previous: <a href="Floating_002dpoint-Computations.html" accesskey="p" rel="prev">Floating-point Computations</a>, Up: <a href="Floating_002dpoint-Computations.html" accesskey="u" rel="up">Floating-point Computations</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="Rule-of-Float-and-Rational-Contagion-1"></span><h4 class="subsubsection">12.1.4.1 Rule of Float and Rational Contagion</h4> |
| 46 |
|
| 47 |
<p>When <i>rationals</i> and <i>floats</i> are combined by a numerical function, |
| 48 |
the <i>rational</i> is first converted to a <i>float</i> of the same format. |
| 49 |
For <i>functions</i> such as <b>+</b> that take more than two arguments, |
| 50 |
it is permitted that part of the operation be carried out exactly using |
| 51 |
<i>rationals</i> and the rest be done using floating-point arithmetic. |
| 52 |
</p> |
| 53 |
<p>When <i>rationals</i> and <i>floats</i> are compared by a numerical function, |
| 54 |
the <i>function</i> <b>rational</b> is effectively called to convert the <i>float</i> |
| 55 |
to a <i>rational</i> and then an exact |
| 56 |
comparison is performed. In the case of <i>complex</i> numbers, |
| 57 |
the real and imaginary parts are effectively handled individually. |
| 58 |
</p> |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
</body> |
| 63 |
</html> |