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

Function LTnum

depends/lua/src/lvm.c:318–335  ·  view source on GitHub ↗

** Return 'l < r', for numbers. */

Source from the content-addressed store, hash-verified

316** Return 'l < r', for numbers.
317*/
318static int LTnum (const TValue *l, const TValue *r) {
319 if (ttisinteger(l)) {
320 lua_Integer li = ivalue(l);
321 if (ttisinteger(r))
322 return li < ivalue(r); /* both are integers */
323 else /* 'l' is int and 'r' is float */
324 return LTintfloat(li, fltvalue(r)); /* l < r ? */
325 }
326 else {
327 lua_Number lf = fltvalue(l); /* 'l' must be float */
328 if (ttisfloat(r))
329 return luai_numlt(lf, fltvalue(r)); /* both are float */
330 else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */
331 return 0; /* NaN < i is always false */
332 else /* without NaN, (l < r) <--> not(r <= l) */
333 return !LEintfloat(ivalue(r), lf); /* not (r <= l) ? */
334 }
335}
336
337
338/*

Callers 1

luaV_lessthanFunction · 0.85

Calls 2

LTintfloatFunction · 0.85
LEintfloatFunction · 0.85

Tested by

no test coverage detected