lua-users home
lua-l archive

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



LNum patches is a place for any Lua number oriented patches:

http://luaforge.net/projects/lnum/


At an opening evening, I'll place there a recent 'lnum-290806.patch', alongside a full 'lua-5.1.1-patched.tgz' to try out. This patch presents an effort to make integer numbers live along, within the Lua core, and without shaking the boat all too much. The default number mode remains 'double' (all FP data); but integers are stored in the bytecode.

Other number modes, selectable simply by "make macosx MYCFLAGS=- DLUA_NUMBER_MODE_xxx" are:

  LUA_NUMBER_MODE_DOUBLE_INT64		int64 value range
  LUA_NUMBER_MODE_FLOAT_INT64		-''-
LUA_NUMBER_MODE_DOUBLE_INT32 int32 value range, for non-FPU systems s.a.ARM
  LUA_NUMBER_MODE_FLOAT_INT32		-''-
  LUA_NUMBER_MODE_BCD_INT32		Binary Coded Decimal (tbd)
  LUA_NUMBER_MODE_COMPLEX		double + doublei (tbd)

This is a proof of concept, but for people needing to run Lua 5.1 on non-FPU platforms, it is already worth a try. API's etc. have remained; this should be 100% backward compatible with Lua.

Known bugs:
- LUA_NUMBER_MODE_FLOAT_INT64: 9+1 = 9. Why?? (debugging help not turned back!) - File IO with number types not tested (would You have time to test? :)
- Performance tests not run for ages... (but should be Good)

Note that the LNum patches site at LuaForge is not intended for this approach alone. It's there for _any_ number mode specific approaches, and discussions.

-asko


p.s. Oh, and the files can also be accessed by "svn co svn:// slugak.dyndns.org/public/lnum/" (daily changes)