[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Change request for 5.2: luai_lnumdiv and luai_lnummod
- From: David Jones <drj@...>
- Date: Thu, 27 Jul 2006 15:17:40 +0100
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