MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / math_fmod

Function math_fmod

third-party/lua-5.5.0/src/lmathlib.c:124–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122
123
124static int math_fmod (lua_State *L) {
125 if (lua_isinteger(L, 1) && lua_isinteger(L, 2)) {
126 lua_Integer d = lua_tointeger(L, 2);
127 if ((lua_Unsigned)d + 1u <= 1u) { /* special cases: -1 or 0 */
128 luaL_argcheck(L, d != 0, 2, "zero");
129 lua_pushinteger(L, 0); /* avoid overflow with 0x80000... / -1 */
130 }
131 else
132 lua_pushinteger(L, lua_tointeger(L, 1) % d);
133 }
134 else
135 lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1),
136 luaL_checknumber(L, 2)));
137 return 1;
138}
139
140
141/*

Callers

nothing calls this directly

Calls 5

lua_isintegerFunction · 0.70
lua_pushintegerFunction · 0.70
lua_pushnumberFunction · 0.70
luaL_checknumberFunction · 0.70
lua_tointegerFunction · 0.50

Tested by

no test coverage detected