lua-users home
lua-l archive

Re: Change request for 5.2: luai_lnumdiv and luai_lnummod

[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
zero.
[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.
Seconded.
There are floating point environments where this is useful too.
drj

AltStyle によって変換されたページ (->オリジナル) /