|
eugeny gladkih wrote:
"LHdF" == Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> writes:>> I know that I am not alone in my toils to upgrade to new versions of Lua >> even in an ANSI C environment when all I want to do is eliminate >> floating point. LHdF> For the Lua core, isn't it a simple matter of defining the correct LHdF> luai_num* macros and LUA_NUMBER_SCAN, LUA_NUMBER_FMTin LHdF> luaconf.h? and we'll have problems with math library
So you modify the lua startup code to NOT open the math library, and everything is OK except for two other things in luaconf.h 1. num_mod() must be redefined to be ((a)%(b)) 2. num_pow() must be redefined to call a function that calculates exponents of integer numbers. Mine does an iterative multiply for b>0 and iterative divide for b<0. Make it work, then make it fast :-) I never did go back and figure out a way to do this non-iteratively. You may also need to redefine LUAI_MAXNUMBER2STR and str2number() Ralph