Repeat Loop

Jim Ault jimaultwins at yahoo.com
Sun Nov 22 12:12:39 EST 2009


Another way to deal with decimal-digital dichotomies is to use the  
equivalent of the good old FPU.

Remember the days when the Floating-point Processor Unit was a  
separate chip that was optional?  Using floating point math always  
slowed down computations because of the monster iterations and rules  
it would use.  We in the scientific community required this, but  
accounting and business did not.  Of course, my days in the scientific  
community started before there were personal computers or even  
calculators ( we used slide rules where the FPU was us ).

One could build an external and call it to do math when decimals and  
rounding rules were important.

Jim Ault
Las Vegas

On Nov 21, 2009, at 7:28 AM, DunbarX at aol.com wrote:

> Rounding it must be. But the error is related to the startValue.
>
> I would have thought that it did not matter, when incrementing by  
> 0.1, say,
> what the StartValue was. In other words, I would have thought that
> incrementing like this:
>
> repeat with y = 1 to 2 step 0.1
>
> would have the same rounding error progression as:
>
> repeat with y =   3 to 4 step 0.1
>
> Half the possible startValues (up to infinity?) round down at the  
> nominal
> last step, and therefore force an addiional unwanted loop, and half  
> must
> round up, and act properly. There is a precise method to the error,  
> since it
> falls within the odd binary sequence I posted yesterday.
>
> It is a real shame that setting the numberformat (per Jacques  
> Hausser) does
> not seem to affect step increments. That would be a logical  
> workaround that
> forgives digital hardware limitations in a sensible way.
>
> As has been suggested, I suppose one could always just normalize to
> integers, though the startValue and increments usually driectly  
> relate to the
> thinking behind process we are working with:
>
> repeat with y = 10 to 20 step 1
>
> Not the same, is it?
>
> Craig Newman
> In a message dated 11/21/09 6:20:50 AM, wjm at wjm.org writes:
>
>
>> Rounding error. On the second-to-last iteration, Rev doesn't think  
>> it's
>> quite reached "1" yet, so it goes through the loop one more time.
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

Jim Ault
jimaultwins at yahoo.com






More information about the use-livecode mailing list