lua-users home
lua-l archive

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


On Wed, Aug 3, 2011 at 3:38 PM, Norman Ramsey <nr@cs.tufts.edu> wrote:
> That's really unfortunate.  I liked the story about 'all numbers are
> IEEE doubles', but it sounds like the real story is 'all numbers are
> IEEE doubles, except when they are cast to C ints.'   That's not
> nearly as good.

Is see it as:

- "Number represents real (double-precision floating-point) numbers"
(2.2 - Values and Types)

- " The format string follows the same rules as the printf family of
standard C functions." (5.4 - String Manipulation)

- "d, i  : The int argument....." (man sprintf)

there, %d means a C int argument, so the LuaNumber is cast to int.  in
most builds, that's 32 bit signed.   no mysteries, not Lua's fault.

-- 
Javier