** Return 'l <= r', for numbers. */
| 339 | ** Return 'l <= r', for numbers. |
| 340 | */ |
| 341 | static int LEnum (const TValue *l, const TValue *r) { |
| 342 | if (ttisinteger(l)) { |
| 343 | lua_Integer li = ivalue(l); |
| 344 | if (ttisinteger(r)) |
| 345 | return li <= ivalue(r); /* both are integers */ |
| 346 | else /* 'l' is int and 'r' is float */ |
| 347 | return LEintfloat(li, fltvalue(r)); /* l <= r ? */ |
| 348 | } |
| 349 | else { |
| 350 | lua_Number lf = fltvalue(l); /* 'l' must be float */ |
| 351 | if (ttisfloat(r)) |
| 352 | return luai_numle(lf, fltvalue(r)); /* both are float */ |
| 353 | else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ |
| 354 | return 0; /* NaN <= i is always false */ |
| 355 | else /* without NaN, (l <= r) <--> not(r < l) */ |
| 356 | return !LTintfloat(ivalue(r), lf); /* not (r < l) ? */ |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | |
| 361 | /* |
no test coverage detected