home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / fraction.seq < prev    next >
Text File  |  1990-04-08  |  459b  |  20 lines

  1.  
  2. \ The following definiton will display the improper fraction
  3. \ m/n  in the form i.xxxx  where p is the number of decimal
  4. \ digits to follow the decimal point.
  5.  
  6. : I.X  ( m n p -- )
  7.         >R  DUP >R    \ Save precision and a copy of divisor
  8.         /MOD  .       \ Display integer portion.
  9.         1 BACKSPACES
  10.         ASCII . EMIT
  11.         R> R>
  12.         0 DO
  13.             >R  10 R@ */MOD
  14.             48 + EMIT R>
  15.           LOOP 2DROP ;
  16.  
  17.  
  18.  
  19.  
  20.