MCPcopy Create free account
hub / github.com/DFHack/dfhack / LEintfloat

Function LEintfloat

depends/lua/src/lvm.c:300–312  ·  view source on GitHub ↗

** Check whether integer 'i' is less than or equal to float 'f'. ** See comments on previous function. */

Source from the content-addressed store, hash-verified

298** See comments on previous function.
299*/
300static int LEintfloat (lua_Integer i, lua_Number f) {
301#if defined(l_intfitsf)
302 if (!l_intfitsf(i)) {
303 if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */
304 return 1; /* f >= maxint + 1 > i */
305 else if (f >= cast_num(LUA_MININTEGER)) /* minint <= f <= maxint ? */
306 return (i <= cast(lua_Integer, f)); /* compare them as integers */
307 else /* f < minint <= i (or 'f' is NaN) --> not(i <= f) */
308 return 0;
309 }
310#endif
311 return luai_numle(cast_num(i), f); /* compare them as floats */
312}
313
314
315/*

Callers 2

LTnumFunction · 0.85
LEnumFunction · 0.85

Calls 1

castFunction · 0.85

Tested by

no test coverage detected