umouse

umouse.git
git clone git://git.lenczewski.org/umouse.git
Log | Files | Refs | Submodules | README

DPANS8.HTM (11451B)


      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=dpans7.htm><img src=left.gif
     12  width=26 height=26 align=ALIGN border=0></a>
     13 <a href=dpans9.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=8.>Table of Contents</a>
     20 </td>
     21 </tr>
     22 </table>
     23 <p>
     24 <hr size=4>
     25 
     26 <H1>8. The optional Double-Number word set</H1>
     27 
     28 <p>
     29 <code>
     30 See:
     31 <a href=dpansa8.htm#A.8>A.8</a> The optional Double-Number word set
     32 </code>
     33 
     34 <hr>
     35 <a name=8.1>
     36 <H2>8.1 Introduction</H2>
     37 </a>
     38 
     39 Sixteen-bit Forth systems often use double-length numbers.  However,
     40 many Forths on small embedded systems do not, and many users of Forth on
     41 systems with a cell size of 32 bits or more find that the use of
     42 double-length numbers is much diminished.  Therefore, the words that
     43 manipulate double-length entities have been placed in this optional word
     44 set.
     45 
     46 <P>
     47 
     48 <hr>
     49 <A name=8.2>
     50 <H2>8.2 Additional terms and notation</H2>
     51 </a>
     52 
     53 None.
     54 
     55 <P>
     56 
     57 <hr>
     58 <A name=8.3>
     59 <H2>8.3 Additional usage requirements</H2>
     60 </a>
     61 
     62 
     63 <hr>
     64 <A name=8.3.1>
     65 <H3>8.3.1 Environmental queries</H3>
     66 </a>
     67 
     68 Append table 8.1
     69 to table 3.5.
     70 <P>
     71 
     72 <code>
     73 See:
     74 <A href=dpans3.htm#3.2.6>3.2.6</a> Environmental queries
     75 </code>
     76 
     77 <P>
     78 
     79 Table 8.1 - Environmental Query Strings
     80 <P>
     81 
     82 
     83 <PRE>
     84 String         Value data type   Constant?   Meaning
     85 ------         ---------------   ---------   -------
     86 DOUBLE          flag             no          double-number word set present
     87 DOUBLE-EXT      flag             no          double-number extensions word set present
     88 </PRE>
     89 
     90 <P>
     91 
     92 
     93 <hr>
     94 <A name=8.3.2>
     95 <H3>8.3.2 Text interpreter input number conversion</H3>
     96 </a>
     97 
     98 When the text interpreter processes a number that is immediately
     99 followed by a decimal point and is not found as a definition name, the
    100 text interpreter shall convert it to a double-cell number.
    101 <P>
    102 
    103 For example, entering DECIMAL 1234 leaves the single-cell number 1234 on
    104 the stack, and entering DECIMAL 1234.  leaves the double-cell number
    105 1234 0 on the stack.
    106 <P>
    107 
    108 <code>
    109 See:
    110 <A href=dpans3.htm#3.4.1.3>3.4.1.3</a> Text interpreter input number
    111 conversion,
    112 <a href=a0004.htm>RFI 0004</a> Number Conversion.
    113 </code>
    114 
    115 <P>
    116 
    117 <hr>
    118 <A name=8.4>
    119 <H2>8.4 Additional documentation requirements</H2>
    120 </a>
    121 
    122 
    123 <hr>
    124 <A name=8.4.1>
    125 <H3>8.4.1 System documentation</H3>
    126 </a>
    127 
    128 
    129 <hr>
    130 <A name=8.4.1.1>
    131 <H4>8.4.1.1 Implementation-defined options</H4>
    132 </a>
    133 
    134 <UL>
    135 <LI>no additional requirements.
    136 </UL>
    137 <P>
    138 
    139 <hr>
    140 <A name=8.4.1.2>
    141 <H4>8.4.1.2 Ambiguous conditions</H4>
    142 </a>
    143 
    144 <UL>
    145 <LI>d outside range of n in 
    146 <a href=dpans8.htm#8.6.1.1140>8.6.1.1140</a> D&gt;S.
    147 </UL>
    148 <P>
    149 
    150 <hr>
    151 <A name=8.4.1.3>
    152 <H4>8.4.1.3 Other system documentation</H4>
    153 </a>
    154 
    155 <UL>
    156 <LI>no additional requirements.
    157 </UL>
    158 <P>
    159 
    160 
    161 <hr>
    162 <A name=8.4.2>
    163 <H3>8.4.2 Program documentation</H3>
    164 </a>
    165 
    166 <UL>
    167 <LI>no additional requirements.
    168 </UL>
    169 <P>
    170 
    171 
    172 <hr>
    173 <A name=8.5>
    174 <H2>8.5 Compliance and labeling</H2>
    175 </a>
    176 
    177 
    178 <hr>
    179 <A name=8.5.1>
    180 <H3>8.5.1 ANS Forth systems</H3>
    181 </a>
    182 
    183 The phrase <B>Providing the Double-Number word set</B> shall be appended
    184 to the label of any Standard System that provides all of the
    185 Double-Number word set.
    186 <P>
    187 
    188 The phrase <B>Providing name(s) from the Double-Number Extensions word
    189 set</B> shall be appended to the label of any Standard System that
    190 provides portions of the Double-Number Extensions word set.
    191 <P>
    192 
    193 The phrase <B>Providing the Double-Number Extensions word set</B> shall
    194 be appended to the label of any Standard System that provides all of the
    195 Double-Number and Double-Number Extensions word sets.
    196 
    197 <P>
    198 
    199 
    200 <hr>
    201 <A name=8.5.2>
    202 <H3>8.5.2 ANS Forth programs</H3>
    203 </a>
    204 
    205 The phrase <B>Requiring the Double-Number word set</B> shall be appended
    206 to the label of Standard Programs that require the system to provide the
    207 Double-Number word set.
    208 <P>
    209 
    210 The phrase <B>Requiring name(s) from the Double-Number Extensions word
    211 set</B> shall be appended to the label of Standard Programs that require
    212 the system to provide portions of the Double-Number Extensions word set.
    213 <P>
    214 
    215 The phrase <B>Requiring the Double-Number Extensions word set</B> shall
    216 be appended to the label of Standard Programs that require the system to
    217 provide all of the Double-Number and Double-Number Extensions word sets.
    218 
    219 <P>
    220 
    221 
    222 <hr>
    223 <A name=8.6>
    224 <H2>8.6 Glossary</H2>
    225 </a>
    226 
    227 
    228 <hr>
    229 <A name=8.6.1>
    230 <H3>8.6.1 Double-Number words</H3>
    231 </a>
    232 
    233 
    234 
    235 <hr>
    236 <A name=8.6.1.0360>
    237 <code>
    238 8.6.1.0360 <b>2CONSTANT</b>
    239 </code>
    240 </a>
    241 <BR>
    242 <B>two-constant</B>  DOUBLE
    243 <BR>
    244 <pre>
    245 	( x1 x2 <B>"&lt;spaces&gt;name"</B> -- )
    246 </pre>
    247 <P>
    248 
    249 Skip leading space delimiters.  Parse name delimited by a space.  Create
    250 a definition for name with the execution semantics defined below.
    251 <P>
    252 
    253 name is referred to
    254 as a <B>two-constant</B>.
    255 <P>
    256 <pre>
    257         <i>name</i> Execution: ( -- x1 x2 )
    258 </pre>
    259 <P>
    260 
    261 Place cell
    262 pair x1 x2 on the stack.
    263 <P>
    264 
    265 <code>
    266 See:
    267 <A href=dpans3.htm#3.4.1>3.4.1</a> Parsing,
    268 <a href=dpansa8.htm#A.8.6.1.0360>A.8.6.1.0360 2CONSTANT</a>
    269 </code>
    270 
    271 <P>
    272 
    273 <hr>
    274 <A name=8.6.1.0390>
    275 <code>
    276 8.6.1.0390 <b>2LITERAL</b>
    277 </code>
    278 </a>
    279 <BR>
    280   <B>two-literal</B>   DOUBLE
    281 <BR>
    282 <P>
    283 <pre>
    284         Interpretation: Interpretation semantics for this word are undefined.
    285 </pre>
    286 <P>
    287 <pre>
    288 	Compilation: ( x1 x2 -- )
    289 </pre>
    290 <P>
    291 
    292 Append the run-time semantics
    293 below to the current definition.
    294 <P>
    295 <pre>
    296         Run-time: ( -- x1 x2 )
    297 </pre>
    298 <P>
    299 
    300 Place cell pair
    301 x1 x2 on the stack.
    302 
    303 <p>
    304 <code>
    305 See:
    306 <a href=dpansa8.htm#A.8.6.1.0390>A.8.6.1.0390 2LITERAL</a>
    307 </code>
    308 
    309 <P>
    310 
    311 <hr>
    312 <A name=8.6.1.0440>
    313 <code>
    314 8.6.1.0440 <b>2VARIABLE</b>
    315 </code>
    316 </a>
    317 <BR>
    318 <B>two-variable</B>  DOUBLE
    319 <BR>
    320 <pre>
    321 	( <B>"&lt;spaces&gt;name"</B> -- )
    322 </pre>
    323 
    324 <P>
    325 
    326 Skip leading space delimiters.  Parse name delimited by a space.  Create
    327 a definition for name with the execution semantics defined below.
    328 Reserve two consecutive cells of data space.
    329 <P>
    330 
    331 name is referred to
    332 as a <B>two-variable</B>.
    333 <P>
    334 <pre>
    335         <i>name</i> Execution: ( -- a-addr )
    336 </pre>
    337 <P>
    338 
    339 a-addr is the address of the first (lowest address) cell of two
    340 consecutive cells in data space reserved by 2VARIABLE when it defined
    341 name.  A program is responsible for initializing the contents.
    342 <P>
    343 
    344 <code>
    345 See:
    346 <A href=dpans3.htm#3.4.1>3.4.1</a> Parsing,
    347 <A href=dpans6.htm#6.1.2410>6.1.2410 VARIABLE</a> ,
    348 <a href=dpansa8.htm#A.8.6.1.0440>A.8.6.1.0440 2VARIABLE</a>
    349 </code>
    350 
    351 
    352 <P>
    353 
    354 <hr>
    355 <A name=8.6.1.1040>
    356 <code>
    357 8.6.1.1040 <b>D+</b>
    358 </code>
    359 </a>
    360 <BR>
    361 <B>d-plus</B>        DOUBLE
    362 <BR>
    363 <pre>
    364 	( d1|ud1 d2|ud2 -- d3|ud3 )
    365 </pre>
    366 
    367 <P>
    368 
    369 Add d2|ud2 to d1|ud1,
    370 giving the sum d3|ud3.
    371 
    372 <P>
    373 
    374 <hr>
    375 <A name=8.6.1.1050>
    376 <code>
    377 8.6.1.1050 <b>D-</b>
    378 </code>
    379 </a>
    380 <BR>
    381 <B>d-minus</B>       DOUBLE
    382 <BR>
    383 <pre>
    384 	( d1|ud1 d2|ud2 -- d3|ud3 )
    385 </pre>
    386 
    387 <P>
    388 
    389 Subtract d2|ud2 from d1|ud1,
    390 giving the difference d3|ud3.
    391 
    392 <P>
    393 
    394 <hr>
    395 <A name=8.6.1.1060>
    396 <code>
    397 8.6.1.1060 <b>D.</b>
    398 </code>
    399 </a>
    400 <BR>
    401 <B>d-dot</B> DOUBLE
    402 <BR>
    403 <pre>
    404 	( d -- )
    405 </pre>
    406 
    407 <P>
    408 
    409 Display d in
    410 free field format.
    411 
    412 <P>
    413 
    414 <hr>
    415 <A name=8.6.1.1070>
    416 <code>
    417 8.6.1.1070 <b>D.R</b>
    418 </code>
    419 </a>
    420 <BR>
    421 <B>d-dot-r</B>       DOUBLE
    422 <BR>
    423 <pre>
    424 	( d n -- )
    425 </pre>
    426 
    427 <P>
    428 
    429 Display d right aligned in a field n characters wide.  If the number of
    430 characters required to display d is greater than n, all digits are
    431 displayed with no leading spaces in a field as wide as necessary.
    432 
    433 <p>
    434 <code>
    435 See:
    436 <a href=dpansa8.htm#A.8.6.1.1070>A.8.6.1.1070 D.R</a>
    437 </code>
    438 
    439 <P>
    440 
    441 <hr>
    442 <A name=8.6.1.1075>
    443 <code>
    444 8.6.1.1075 <b>D0&lt;</b>
    445 </code>
    446 </a>
    447 <BR>
    448 <B>d-zero-less</B>   DOUBLE
    449 <BR>
    450 <pre>
    451 	( d -- flag )
    452 </pre>
    453 
    454 <P>
    455 
    456 flag is true if and
    457 only if d is less than zero.
    458 
    459 <P>
    460 
    461 <hr>
    462 <A name=8.6.1.1080>
    463 <code>
    464 8.6.1.1080 <b>D0=</b>
    465 </code>
    466 </a>
    467 <BR>
    468 <B>d-zero-equals</B> DOUBLE
    469 <BR>
    470 <pre>
    471 	( xd -- flag )
    472 </pre>
    473 
    474 <P>
    475 
    476 flag is true if and
    477 only if xd is equal to zero.
    478 
    479 <P>
    480 
    481 <hr>
    482 <A name=8.6.1.1090>
    483 <code>
    484 8.6.1.1090 <b>D2*</b>
    485 </code>
    486 </a>
    487 <BR>
    488 <B>d-two-star</B>    DOUBLE
    489 <BR>
    490 <pre>
    491 	( xd1 -- xd2 )
    492 </pre>
    493 
    494 <P>
    495 
    496 xd2 is the result of shifting xd1 one bit toward the most-significant bit,
    497 filling the vacated least-significant bit with zero.
    498 
    499 
    500 <p>
    501 <code>
    502 See:
    503 <a href=dpansa8.htm#A.8.6.1.1090>A.8.6.1.1090 D2*</a>
    504 </code>
    505 
    506 <P>
    507 
    508 <hr>
    509 <A name=8.6.1.1100>
    510 <code>
    511 8.6.1.1100 <b>D2/</b>
    512 </code>
    513 </a>
    514 <BR>
    515 <B>d-two-slash</B>   DOUBLE
    516 <BR>
    517 <pre>
    518 	( xd1 -- xd2 )
    519 </pre>
    520 
    521 <P>
    522 
    523 xd2 is the result of shifting xd1 one bit toward the least-significant bit,
    524 leaving the most-significant bit unchanged.
    525 
    526 <p>
    527 <code>
    528 See:
    529 <a href=dpansa8.htm#A.8.6.1.1100>A.8.6.1.1100 D2/</a>
    530 </code>
    531 
    532 <P>
    533 
    534 <hr>
    535 <A name=8.6.1.1110>
    536 <code>
    537 8.6.1.1110 <b>D&lt;</b>
    538 </code>
    539 </a>
    540 <BR>
    541 <B>d-less-than</B>   DOUBLE
    542 <BR>
    543 <pre>
    544 	( d1 d2 -- flag )
    545 </pre>
    546 
    547 <P>
    548 
    549 flag is true if and only
    550 if d1 is less than d2.
    551 
    552 <P>
    553 
    554 <hr>
    555 <A name=8.6.1.1120>
    556 <code>
    557 8.6.1.1120 <b>D=</b>
    558 </code>
    559 </a>
    560 <BR>
    561 <B>d-equals</B>      DOUBLE
    562 <BR>
    563 <pre>
    564 	( xd1 xd2 -- flag )
    565 </pre>
    566 
    567 <P>
    568 
    569 flag is true if and only if xd1
    570 is bit-for-bit the same as xd2.
    571 
    572 <P>
    573 
    574 <hr>
    575 <A name=8.6.1.1140>
    576 <code>
    577 8.6.1.1140 <b>D&gt;S</b>
    578 </code>
    579 </a>
    580 <BR>
    581 <B>d-to-s</B>        DOUBLE
    582 <BR>
    583 <pre>
    584 	( d -- n )
    585 </pre>
    586 
    587 <P>
    588 
    589 n is the equivalent of d.  An ambiguous condition exists if d lies
    590 outside the range of a signed single-cell number.
    591 
    592 
    593 <p>
    594 <code>
    595 See:
    596 <a href=dpansa8.htm#A.8.6.1.1140>A.8.6.1.1140 D&gt;S</a>
    597 </code>
    598 
    599 <P>
    600 
    601 <hr>
    602 <A name=8.6.1.1160>
    603 <code>
    604 8.6.1.1160 <b>DABS</b>
    605 </code>
    606 </a>
    607 <BR>
    608 <B>d-abs</B> DOUBLE
    609 <BR>
    610 <pre>
    611 	( d -- ud )
    612 </pre>
    613 
    614 <P>
    615 
    616 ud is the
    617 absolute value of d.
    618 
    619 <P>
    620 
    621 <hr>
    622 <A name=8.6.1.1210>
    623 <code>
    624 8.6.1.1210 <b>DMAX</b>
    625 </code>
    626 </a>
    627 <BR>
    628 <B>d-max</B> DOUBLE
    629 <BR>
    630 <pre>
    631 	( d1 d2 -- d3 )
    632 </pre>
    633 
    634 <P>
    635 
    636 d3 is the
    637 greater of d1 and d2.
    638 
    639 <P>
    640 
    641 <hr>
    642 <A name=8.6.1.1220>
    643 <code>
    644 8.6.1.1220 <b>DMIN</b>
    645 </code>
    646 </a>
    647 <BR>
    648 <B>d-min</B> DOUBLE
    649 <BR>
    650 <pre>
    651 	( d1 d2 -- d3 )
    652 </pre>
    653 
    654 <P>
    655 
    656 d3 is the
    657 lesser of d1 and d2.
    658 
    659 <P>
    660 
    661 <hr>
    662 <A name=8.6.1.1230>
    663 <code>
    664 8.6.1.1230 <b>DNEGATE</b>
    665 </code>
    666 </a>
    667 <BR>
    668 <B>d-negate</B>      DOUBLE
    669 <BR>
    670 <pre>
    671 	( d1 -- d2 )
    672 </pre>
    673 
    674 <P>
    675 
    676 d2 is
    677 the negation of d1.
    678 
    679 <P>
    680 
    681 <hr>
    682 <A name=8.6.1.1820>
    683 <code>
    684 8.6.1.1820 <b>M*/</b>
    685 </code>
    686 </a>
    687 <BR>
    688 <B>m-star-slash</B>  DOUBLE
    689 <BR>
    690 <pre>
    691 	( d1 n1 +n2 -- d2 )
    692 </pre>
    693 
    694 <P>
    695 
    696 Multiply d1 by n1 producing the triple-cell intermediate result t.
    697 Divide t by +n2 giving the double-cell quotient d2.  An ambiguous
    698 condition exists if +n2 is zero or negative, or the quotient lies
    699 outside of the range of a double-precision signed integer.
    700 
    701 <p>
    702 <code>
    703 See:
    704 <a href=dpansa8.htm#A.8.6.1.1820>A.8.6.1.1820 M*/</a>
    705 </code>
    706 
    707 <P>
    708 
    709 <hr>
    710 <A name=8.6.1.1830>
    711 <code>
    712 8.6.1.1830 <b>M+</b>
    713 </code>
    714 </a>
    715 <BR>
    716 <B>m-plus</B>        DOUBLE
    717 <BR>
    718 <pre>
    719 	( d1|ud1 n -- d2|ud2 )
    720 </pre>
    721 
    722 <P>
    723 
    724 Add n to d1|ud1,
    725 giving the sum d2|ud2.
    726 
    727 <p>
    728 <code>
    729 See:
    730 <a href=dpansa8.htm#A.8.6.1.1830>A.8.6.1.1830 M+</a>
    731 </code>
    732 
    733 <P>
    734 
    735 <hr>
    736 <A name=8.6.2>
    737 <H3>8.6.2 Double-Number extension words</H3>
    738 </a>
    739 
    740 <hr>
    741 <A name=8.6.2.0420>
    742 <code>
    743 8.6.2.0420 <b>2ROT</b>
    744 </code>
    745 </a>
    746 <BR>
    747 <B>two-rote</B>      DOUBLE EXT
    748 <pre>
    749 	( x1 x2 x3 x4 x5 x6 -- x3 x4 x5 x6 x1 x2 )
    750 </pre>
    751 
    752 <P>
    753 
    754 Rotate the top three cell pairs on the stack bringing cell pair x1 x2 to
    755 the top of the stack.
    756 
    757 <P>
    758 
    759 <hr>
    760 <A name=8.6.2.1270>
    761 <code>
    762 8.6.2.1270 <b>DU<</b>
    763 </code>
    764 </a>
    765 <BR>
    766 <B>d-u-less</B>      DOUBLE EXT
    767 <BR>
    768 <pre>
    769 	( ud1 ud2 -- flag )
    770 </pre>
    771 <P>
    772 
    773 flag is true if
    774 and only if ud1 is less than ud2.
    775 
    776 
    777 
    778 <hr>
    779 <A href=dpans.htm#toc><IMG   src="up.gif" ></A>    Table of Contents 
    780 <BR>
    781 <A href=dpans9.htm><IMG   src="right.gif" ></A>
    782 Next Section
    783 <P>
    784 </BODY>
    785 </HTML>