** Return 'l < r', for numbers. */
| 316 | ** Return 'l < r', for numbers. |
| 317 | */ |
| 318 | static 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 | /* |
no test coverage detected