Small cleaning services · lua/lua@dd09567 · GitHub
Skip to content

Commit dd09567

Browse files
committed
Small cleaning services
1 parent 53dc5a3 commit dd09567

3 files changed

Lines changed: 46 additions & 30 deletions

File tree

‎lfunc.c‎

Lines changed: 1 addition & 2 deletions

‎lmathlib.c‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,37 @@ static int math_abs (lua_State *L) {
3838
return 1;
3939
}
4040

41+
4142
static int math_sin (lua_State *L) {
4243
lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1)));
4344
return 1;
4445
}
4546

47+
4648
static int math_cos (lua_State *L) {
4749
lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1)));
4850
return 1;
4951
}
5052

53+
5154
static int math_tan (lua_State *L) {
5255
lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1)));
5356
return 1;
5457
}
5558

59+
5660
static int math_asin (lua_State *L) {
5761
lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1)));
5862
return 1;
5963
}
6064

65+
6166
static int math_acos (lua_State *L) {
6267
lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1)));
6368
return 1;
6469
}
6570

71+
6672
static int math_atan (lua_State *L) {
6773
lua_Number y = luaL_checknumber(L, 1);
6874
lua_Number x = luaL_optnumber(L, 2, 1);
@@ -167,6 +173,7 @@ static int math_ult (lua_State *L) {
167173
return 1;
168174
}
169175

176+
170177
static int math_log (lua_State *L) {
171178
lua_Number x = luaL_checknumber(L, 1);
172179
lua_Number res;
@@ -188,28 +195,34 @@ static int math_log (lua_State *L) {
188195
return 1;
189196
}
190197

198+
191199
static int math_exp (lua_State *L) {
192200
lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1)));
193201
return 1;
194202
}
195203

204+
196205
static int math_deg (lua_State *L) {
197206
lua_pushnumber(L, luaL_checknumber(L, 1) * (l_mathop(180.0) / PI));
198207
return 1;
199208
}
200209

210+
201211
static int math_rad (lua_State *L) {
202212
lua_pushnumber(L, luaL_checknumber(L, 1) * (PI / l_mathop(180.0)));
203213
return 1;
204214
}
205215

216+
206217
static int math_frexp (lua_State *L) {
207-
int e;
208-
lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e));
209-
lua_pushinteger(L, e);
218+
lua_Number x = luaL_checknumber(L, 1);
219+
int ep;
220+
lua_pushnumber(L, l_mathop(frexp)(x, &ep));
221+
lua_pushinteger(L, ep);
210222
return 2;
211223
}
212224

225+
213226
static int math_ldexp (lua_State *L) {
214227
lua_Number x = luaL_checknumber(L, 1);
215228
int ep = (int)luaL_checkinteger(L, 2);

‎lvm.c‎

Lines changed: 29 additions & 25 deletions

0 commit comments

Comments
 (0)