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 116,632 of 117,927   
   Buzz McCool to Buzz McCool   
   Re: Average of a [stack]   
   15 Jul 24 10:18:55   
   
   From: buzz_mccool@yahoo.com   
      
   On 7/12/2024 10:25 AM, Buzz McCool wrote:   
   >>> On 7/10/2024 8:31 PM, dxf wrote:   
   >>>> Simpler to count down.  I find it easier writing for a common-stack   
   >>>> model.   
   >>>>   
   >>>> : FloatStackAvg ( rn ... r -- avg )   
   >>>>     fdepth dup >r ( count)   
   >>>>     begin  1- dup while ( not done)   
   >>>>       >r  f+ ( add two floats)  r>   
   >>>>     repeat  drop   
   >>>>     r> s>f f/ ( sum/count)   
   >>>> ;   
      
   So for a separate floating point stack model:   
      
   : FloatStackAvg     ( rn ... r -- avg )   
   fdepth dup          ( count)   
   [SoupGate killed UU-encoded file dup while ( not done) (0 bytes)]   
   f+                  ( add two floats)   
   repeat drop   
   s>f f/ ;            ( sum/count)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca