lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Coda Highland <chighland@gmail.com> wrote:

> On Sat, Nov 18, 2017 at 1:31 PM, Paige DePol <lual@serfnet.org> wrote:
>> At least with my patch one surprise is removed when using min/max integers,
>> and another when using floating loops and a step size magnitude that is
>> too small to properly affect the loop variables. Thinking about what Dirk
>> said as well, one final tweak could be done with floating loops by adding
>> half the step size to the loop limit variable to ensure the final iteration
>> is executed in the case where the floating precision drifts.
> 
> Except that'll cause an EXTRA iteration to happen if you do something
> like `1, 9.9, 1`.
> 
> /s/ Adam

Very true and obviously I must have misunderstood what the 'fix' was in the
other language then. Which means we're just back into the discussion about
floating-point tolerances. I will just stick with integers for my loops,
that way there is no worry about the cumulative floating point errors. ;)

~Paige