DPANSA8.HTM (3577B)
1 <HTML><HEAD> 2 <TITLE>DPANS94</TITLE> 3 <link disabled rel="stylesheet" href="mpexc6.css"> 4 <style>@import url(mpexc6.css);</style> 5 </head> 6 7 <BODY> 8 <table width=100%> 9 <tr> 10 <td align=left> 11 <a href=dpansa7.htm><img src=left.gif 12 width=26 height=26 align=ALIGN border=0></a> 13 <a href=dpansa9.htm><img src=right.gif 14 width=26 height=26 align=ALIGN border=0></a> 15 </td> 16 <td align=right> 17 <a href=dpans.htm#toc><img src=up.gif 18 width=26 height=26 align=ALIGN border=0></a> 19 <a name=A.8>Table of Contents</a> 20 </td> 21 </tr> 22 </table> 23 <p> 24 <hr size=4> 25 26 <H2>A.8 The optional Double-Number word set</H2> 27 28 Forth systems on 8-bit and 16-bit processors often find it necessary to 29 deal with double-length numbers. But many Forths on small embedded 30 systems do not, and many users of Forth on systems with a cell size of 31 32-bits or more find that the necessity for double-length numbers is 32 much diminished. Therefore, we have factored the words that manipulate 33 double-length entities into this optional word set. 34 35 <P> 36 37 Please note that the naming convention used in this word set conveys 38 some important information: 39 40 <P> 41 42 1. Words whose names are of the form 2xxx deal with cell pairs, where 43 the relationship between the cells is unspecified. They may be 44 two-vectors, double-length numbers, or any pair of cells that it is 45 convenient to manipulate together. 46 47 <P> 48 49 2. Words with names of the form Dxxx deal specifically with 50 double-length integers. 51 52 <P> 53 54 3. Words with names of the form Mxxx deal with some combination of 55 single and double integers. The order in which these appear on the 56 stack is determined by long-standing common practice. 57 58 <P> 59 60 Refer to 61 <a href=dpansa3.htm#A.3.1>A.3.1</a> for a discussion of data types in Forth. 62 63 <P> 64 65 <hr> 66 <a name=A.8.6> 67 <H3>A.8.6 Glossary</H3> 68 </a> 69 70 71 <hr> 72 <a name=A.8.6.1.0360>A.8.6.1.0360 2CONSTANT</A> 73 <P> 74 75 Typical use: <code>x1 x2 2CONSTANT name</code> 76 77 <P> 78 79 <hr> 80 <a name=A.8.6.1.0390>A.8.6.1.0390 2LITERAL</A> 81 <P> 82 83 Typical use: <code>: X ... [ x1 x2 ] 2LITERAL ... ;</code> 84 85 <P> 86 87 <hr> 88 <a name=A.8.6.1.0440>A.8.6.1.0440 2VARIABLE</A> 89 <P> 90 91 Typical use: <code>2VARIABLE name</code> 92 93 <P> 94 95 <hr> 96 <a name=A.8.6.1.1070>A.8.6.1.1070 D.R</A> 97 <P> 98 99 In D.R, the <B>R</B> is short for RIGHT. 100 101 <P> 102 103 <hr> 104 <a name=A.8.6.1.1090>A.8.6.1.1090 D2*</A> 105 <P> 106 <code> 107 See: 108 <a href=dpansa6.htm#A.6.1.0320>A.6.1.0320 2*</a> for applicable 109 discussion. 110 </code> 111 <P> 112 113 <hr> 114 <a name=A.8.6.1.1100>A.8.6.1.1100 D2/</A> 115 <P> 116 <code> 117 See: 118 <a href=dpansa6.htm#A.6.1.0330>A.6.1.0330 2/</a> for applicable 119 discussion. 120 </code> 121 <P> 122 123 <hr> 124 <a name=A.8.6.1.1140>A.8.6.1.1140 D>S</A> 125 <P> 126 127 There exist number representations, e.g., the sign-magnitude 128 representation, where reduction from double- to single-precision cannot 129 simply be done with 130 <a href=dpans6.htm#6.1.1260>DROP</a>. 131 This word, equivalent to DROP on two's 132 complement systems, desensitizes application code to number 133 representation and facilitates portability. 134 135 <P> 136 137 <hr> 138 <a name=A.8.6.1.1820>A.8.6.1.1820 M*/</A> 139 <P> 140 141 M*/ was once described by Chuck Moore as the most useful arithmetic 142 operator in Forth. It is the main workhorse in most computations 143 involving double-cell numbers. Note that some systems allow signed 144 divisors. This can cost a lot in performance on some CPUs. The 145 requirement for a positive divisor has not proven to be a problem. 146 147 <P> 148 149 <hr> 150 <a name=A.8.6.1.1830>A.8.6.1.1830 M+</A> 151 <P> 152 153 M+ is the classical method for integrating. 154 155 <P> 156 157 <hr> 158 <a href=dpans.htm#toc><IMG src="up.gif" ></A> Table of Contents 159 <BR> 160 <a href=dpansa9.htm><IMG src="right.gif" ></A> 161 Next Section 162 <P> 163 </BODY> 164 </HTML>