home bbs files messages ]

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 117,135 of 117,927   
   dxf to Hans Bezemer   
   Re: (FG.) FG.R (was Re: Bring your Forth   
   09 Mar 25 19:34:23   
   
   From: dxforth@gmail.com   
      
   On 9/03/2025 5:02 am, Hans Bezemer wrote:   
   > On 08-03-2025 02:57, dxf wrote:   
   > Ed, as usual - thank you!   
   > Of course, I had to iron out the /STRING and BOOL tricks - but I managed. ;-)   
   >   
   > BTW, I call ( a n -- a+1 n-1) CHOP and ( a n -- a n-1) CLIP. They're dear   
   and well respected friends of mine. I rarely use /STRING myself.   
   >   
      
   One more without the temps to show anyone can write forth.   
   (Just don't ask me to explain it :)   
      
   \ Convert real number r to string with n digits of precision.   
   \ Use fixed-point if exponent -1 to n or scientific otherwise.   
   : (FG.) ( r n -- c-addr u )   
     dup >r  1- (fs.)  2dup [char] . scan 	?dup if ( not nan/inf)   
       over swap  [char] E scan  over swap  cskip   
       /number 2nip d>s  dup -1 r@ within if ( fixed-point)   
         >r  [char] .  rot  dup r@ 0< 2* 1+ +  over r@ abs move   
         r> + c!  nip over -  r> drop  exit   
       then  2drop   
     then  r> 2drop ;   
      
   --- 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