lua-users home
lua-l archive

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



The LNUM patch is useful for this as well. It allows one to easily (with one to two -D flags) set Lua to use any combo of:

  LNUM_DOUBLE (default)         double precision FP (52 bit mantissa)
  LNUM_FLOAT                    single precision FP (23 bit mantissa)
LNUM_LDOUBLE extra precision FP (80+ bit mantissa, varies)

  LNUM_INT32                    -2^31..2^31-1 integer optimized
  LNUM_INT64                    -2^63..2^63-1 integer optimized
  (none)                        		all numbers stored as FP

LNUM_COMPLEX Complex (a+bi) number mode, scalars may be integer optimized

You'd use -DLNUM_INT64 to get 64-bit integer resolution. That's all. The patched Lua remains completely compatible to modules etc. - lua_Integer does become 64 bits wide. Numbers are stored as either 64- bit ints or doubles internally, but to your Lua code and C API it wouldn't be known.

-asko


Al Pfalzgraf kirjoitti 22.2.2008 kello 16:45:


In recent work it would have been helpful if the Lua number accomodated a 64 bit integer.

Would a change of LUA_INTEGER to fpos_t be unacceptable?


Helping your favorite cause is as easy as instant messaging. You IM, we give. Learn more.