lua-users home
lua-l archive

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


Hi Andrew,

> On 12 Oct 2021, at 21:16, Andrew Gierth <andrew@tao11.riddles.org.uk> wrote:
> 
>>>>>> "David" == David Capello <davidcapello@gmail.com> writes:
> 
> David> I’m not sure if this is a proper fix, but it looks like v5.4.3
> David> (and master branch) contains a bug if we define LUA_FLOORN2I=1
> David> when we try to compare an integer value == a number. This is a
> David> possible fix:
> 
> Surely you don't want 1 == 1.4 to compare true, whatever the float to
> integer conversion mode you want to use.


Actually with my patch that comparison fails. The patch works only
when an object is compared with a constant:

  local a = 1
  assert(a == 1.4) -- doesn’t fail
  assert(1.4 == a) -- doesn’t fail

  assert(1 == 1.4) -- fails

This is how it was working on Lua 5.3. Without the patch, 5.4 fails here:

  local a = 1
  assert(a == 1.4)

Anyway I’m not sure if this breaking change on purpose between 5.3 vs 5.4 when LUA_FLOORN2I=1

Kind regards,
- David