lua-users home
lua-l archive

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


> The unfortunate effect of:
> 
> lua_pushnumber(L, floor(r*(u-l+1))+l);

No, it's the unfortunate effect of
	int l = luaL_checkint(L, 1);
	int u = luaL_checkint(L, 2);

In 5.2 it's
	lua_Number l = luaL_checknumber(L, 1);
	lua_Number u = luaL_checknumber(L, 2);

and so we have full precision in floor(r*(u-l+1))+l.