lua-users home
lua-l archive

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


On 11/14/2017 12:49 PM, Viacheslav Usov wrote:
> My impression was that the original poster was unhappy about the "var > limit"
> condition, which, when limit is the max positive integer (or a larger floating
> point value), can never be satisfied. This is not obvious and arguably
> unexpected by programmers. Personally, I agree that having to consider that an
> intermediate value can overflow and derail the computation requires a discipline
> that would be difficult to instil upon myself or others.

Why just not call this a "bug"?

Both code snippets goes over limit value.

  for i = math.mininteger, math.mininteger, -1 do
    print(i)
  end

  for i = math.maxinteger, math.maxinteger do
    print(i)
  end

-- Martin