Deutsch   English   Français   Italiano  
<v6rour$34faa$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Buzz McCool <buzz_mccool@yahoo.com>
Newsgroups: comp.lang.forth
Subject: Re: Average of a [stack]
Date: Fri, 12 Jul 2024 10:25:47 -0700
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <v6rour$34faa$1@dont-email.me>
References: <v3raig$1bhkt$1@dont-email.me>
 <1ae05d1531d54df162c500815909ee37@www.novabbs.com>
 <v6n0pr$2363u$1@dont-email.me> <668f5204$1@news.ausics.net>
 <v6p1ku$2hr48$1@dont-email.me> <6690a89a$1@news.ausics.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 12 Jul 2024 19:25:47 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a8267e87f1b9be8dd1c3dce4c9761f8c";
	logging-data="3292490"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19gPwTMTJu/z3l1NOPEKmY/zBhmqfewLbI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:cLwDmMYJcn2oQ+nTFdiSjEVAA1g=
In-Reply-To: <6690a89a$1@news.ausics.net>
Content-Language: en-US
Bytes: 2590

On 7/11/2024 8:53 PM, dxf wrote:
> On 12/07/2024 2:35 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)
>>> ;
>>>
>>
>> Thanks for sharing.
>>
>> What is the purpose of putting something on and then off the return stack on this line?
>>>        >r  f+ ( add two floats)  r>
>>
>> Your example word seemed to work fine without it.
> 
> Traditionally floats existed on the data stack along with integers, doubles etc.
> This required being sensitive to what was on top of the stack.  As time passed some
> argued floats should have their own stack.  That's now progressed to Forth-200x
> outlawing floats on the data stack.  Implementing a separate float stack is usually
> no issue for 16-bit processors and above but for 8-bit cpu's it's prohibitive.
> My observation is the same people that push for locals also push for floats on a
> separate stack using essentially the same argument.

Thus your earlier comment "I find it easier writing for a common-stack 
model." which went over my head. Thanks for the explanation.