[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Issue with bit shift in Lua 5.4 Work releases
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 6 Jul 2018 12:55:34 -0300
> The following three lines runs without errors in Lua 5.3.
>
> local foo = 13.37
> local bar = foo // 1
> type( bar << 8 )
>
> The shift on the third line fails with Lua 5.4 with the following error:
> "number (local 'bar') has no integer representation".
>
> It still fails with the error "attempt to perform bitwise operation on a nil
> value (local 'bar')" when 'bar' is explicit converted to an integer.
>
> local foo = 13.37
> local bar = math.tointeger( foo // 1 )
> type( bar << 8 )
>
> Is this a bug or did I use the wrong method?
It is a (stupid) bug, but not in bit shift:
> foo = 13.37
> print(foo // 1) --> 13.7
-- Roberto