Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.forth    |    Forth programmers eat a lot of Bratwurst    |    117,927 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 116,991 of 117,927    |
|    dxf to All    |
|    Re: FP number syntax    |
|    02 Jan 25 09:19:53    |
      From: dxforth@gmail.com              Here's a routine from 2003 reworked for clarity. While DPL could have       been avoided it simplified things and perhaps that's its value.              : ?BAD ( n -- ) abort" bad" ;              : /NUM ( a u -- ud a' u' ) dpl off 0 0 2swap >number ;              \ Convert inch (x.yyy) to mils       : /FLOAT ( a u -- mils )        /num 2swap drop >r ( whole) dup if        over c@ [char] . - ?bad 1 /string        then        3 min /num nip ?bad drop ( frac)        ( scale to 0-999 )        1 3 dpl @ - 0 ?do 10 * loop *        r> 1000 * ( scale whole )        + ; ( add frac )              : t bl word count /float u. ;              t 1.234       t 1.2       t 1.2345       t 1              --- SoupGate-DOS v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca