lua-users home
lua-l archive

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

On 27 Jul 2006, at 14:49, John D. Ramsdell wrote:

The file src/luaconf.h greatly eases the task of adjusting the type of
numerical data used by Lua, however, if LUA_NUMBER is defined to be an
integral type, the interpreter must throw an exception on divide by

[to avoid invoking C's undefined behaviour]

  The constant propagation code need not worry about divide by
zero because it checks before it applies a reduction.  Therefore, the
context in which luai_numdiv(a,b) is expanded in the constant
propagation code does not have a lua_State available, while the
interpreter does, and access to that state is needed to signal an
exception.  Please provide a macro for use in each environment.


There are floating point environments where this is useful too.