[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (work1) now available
- From: Doug Currie <doug.currie@...>
- Date: Wed, 10 Jul 2013 10:57:15 -0400
On Jul 9, 2013, at 8:33 PM, Miles Bader <miles@gnu.org> wrote:
> William Ahern <william@25thandClement.com> writes:
>> One quibble: most protocols sanely use unsigned integers. A signed 64-bit
>> integer is 1 bit too short, and generally speaking you're not much better
>> off than with floating point doubles and the bit32 library.
>
> It sort of depends on what you're doing with them. For many uses,
> even if the "real" type is an unsigned integer, a signed integer with
> guaranteed twos-complement overflow/wraparound behavior (as in Lua
> 5.3) will work just fine.
>
> That's one reason their choice of semantics for overflow are really
> pretty nice.
Yes. In fact, I can't think of any use of full 64-bit unsigned integer that won't "work just fine." We can even read and write them:
> return 9223372036854775809
-9223372036854775807
> return string.format("%u",-9223372036854775807)
9223372036854775809
> return string.format("%u",9223372036854775809)
9223372036854775809
> =2^64-1
-1
> return string.format("%u",-1)
18446744073709551615
> return string.format("%u",18446744073709551615)
18446744073709551615
e
- References:
- [ANN] Lua 5.3.0 (work1) now available, Luiz Henrique de Figueiredo
- Re: [ANN] Lua 5.3.0 (work1) now available, Miles Bader
- Re: [ANN] Lua 5.3.0 (work1) now available, Luiz Henrique de Figueiredo
- Re: [ANN] Lua 5.3.0 (work1) now available, Enrico Colombini
- Re: [ANN] Lua 5.3.0 (work1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work1) now available, Lorenzo Donati
- Re: [ANN] Lua 5.3.0 (work1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work1) now available, Lorenzo Donati
- Re: [ANN] Lua 5.3.0 (work1) now available, Joseph Manning
- Re: [ANN] Lua 5.3.0 (work1) now available, Todd Coram
- Re: [ANN] Lua 5.3.0 (work1) now available, William Ahern
- Re: [ANN] Lua 5.3.0 (work1) now available, Miles Bader