MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / math_abs

Function math_abs

3rd/lua-5.4.3/src/lmathlib.c:29–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28
29static int math_abs (lua_State *L) {
30 if (lua_isinteger(L, 1)) {
31 lua_Integer n = lua_tointeger(L, 1);
32 if (n < 0) n = (lua_Integer)(0u - (lua_Unsigned)n);
33 lua_pushinteger(L, n);
34 }
35 else
36 lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1)));
37 return 1;
38}
39
40static int math_sin (lua_State *L) {
41 lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1)));

Callers

nothing calls this directly

Calls 4

lua_pushintegerFunction · 0.85
lua_pushnumberFunction · 0.85
luaL_checknumberFunction · 0.85
lua_isintegerFunction · 0.70

Tested by

no test coverage detected