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

Function LTintfloat

third-party/lua-5.5.0/src/lvm.c:426–436  ·  view source on GitHub ↗

** Check whether integer 'i' is less than float 'f'. If 'i' has an ** exact representation as a float ('l_intfitsf'), compare numbers as ** floats. Otherwise, use the equivalence 'i < f <=> i < ceil(f)'. ** If 'ceil(f)' is out of integer range, either 'f' is greater than ** all integers or less than all integers. ** (The test with 'l_intfitsf' is only for performance; the else ** case is correct f

Source from the content-addressed store, hash-verified

424** When 'f' is NaN, comparisons must result in false.
425*/
426l_sinline int LTintfloat (lua_Integer i, lua_Number f) {
427 if (l_intfitsf(i))
428 return luai_numlt(cast_num(i), f); /* compare them as floats */
429 else { /* i < f <=> i < ceil(f) */
430 lua_Integer fi;
431 if (luaV_flttointeger(f, &fi, F2Iceil)) /* fi = ceil(f) */
432 return i < fi; /* compare them as integers */
433 else /* 'f' is either greater or less than all integers */
434 return f > 0; /* greater? */
435 }
436}
437
438
439/*

Callers 1

LTnumFunction · 0.70

Calls 1

luaV_flttointegerFunction · 0.70

Tested by

no test coverage detected