From f04fe526cd9de3e5460b614b2ff06268ad51872d Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 7 Oct 2003 17:13:41 -0300 Subject: new functions `lua_tointeger' and lua_pushinteger' --- lmathlib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lmathlib.c') diff --git a/lmathlib.c b/lmathlib.c index a4fa618c..6afbcab6 100644 --- a/lmathlib.c +++ b/lmathlib.c @@ -1,5 +1,5 @@ /* -** $Id: lmathlib.c,v 1.55 2003/03/11 12:24:34 roberto Exp roberto $ +** $Id: lmathlib.c,v 1.56 2003/03/11 12:30:37 roberto Exp roberto $ ** Standard mathematical library ** See Copyright Notice in lua.h */ @@ -128,7 +128,7 @@ static int math_rad (lua_State *L) { static int math_frexp (lua_State *L) { int e; lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); - lua_pushnumber(L, e); + lua_pushinteger(L, e); return 2; } @@ -179,14 +179,14 @@ static int math_random (lua_State *L) { case 1: { /* only upper limit */ int u = luaL_checkint(L, 1); luaL_argcheck(L, 1<=u, 1, "interval is empty"); - lua_pushnumber(L, (int)floor(r*u)+1); /* int between 1 and `u' */ + lua_pushnumber(L, floor(r*u)+1); /* int between 1 and `u' */ break; } case 2: { /* lower and upper limits */ int l = luaL_checkint(L, 1); int u = luaL_checkint(L, 2); luaL_argcheck(L, l<=u, 2, "interval is empty"); - lua_pushnumber(L, (int)floor(r*(u-l+1))+l); /* int between `l' and `u' */ + lua_pushnumber(L, floor(r*(u-l+1))+l); /* int between `l' and `u' */ break; } default: return luaL_error(L, "wrong number of arguments"); -- cgit v1.2.3-55-g6feb