[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (work2) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 26 Mar 2014 09:01:05 -0300
> As a side note, arithmetic shift is NOT equivalent to division by a power of two as the two functions have different rounding properties for negative dividends. Assuming you are using a C compiler that *does* do arithmetic shifts with signed operands, the following code will simulate integer division using shifts only:
This is in C. In Lua both are equivalent; integer division in Lua rounds
toward minus infinity, like an arithmetic shift.
-- Roberto
- References:
- [ANN] Lua 5.3.0 (work2) now available, Luiz Henrique de Figueiredo
- Re: [ANN] Lua 5.3.0 (work2) now available, Paul Baker
- Re: [ANN] Lua 5.3.0 (work2) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work2) now available, Coda Highland
- Re: [ANN] Lua 5.3.0 (work2) now available, Dirk Laurie
- Re: [ANN] Lua 5.3.0 (work2) now available, Coda Highland
- Re: [ANN] Lua 5.3.0 (work2) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work2) now available, Tim Hill
- Re: [ANN] Lua 5.3.0 (work2) now available, Enrico Colombini
- Re: [ANN] Lua 5.3.0 (work2) now available, Tim Hill