lua-users home
lua-l archive

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


> On Jul 9, 2013 5:44 PM, "Sean Conner" <sean@conman.org> wrote:
> > > print(2^64)
> > 18446744073709551616
> > > print(2^64+1)
> > 18446744073709551616
> 
> Looks like that's not quite perfect. (Also I suspect you made that patch
> backwards.)

This result is correct. On many (all?) Intel CPUs, long double uses
80-bit floats, which have exactly 64 bits in their mantissas. So, they
count correctly up to 2^64, but after that they lose precision. (Because
of alignment, the sizeof of a long double usually is larger than 80
bits.)

-- Roberto