** Check whether integer 'i' is less than or equal to float 'f'. ** See comments on previous function. */
| 298 | ** See comments on previous function. |
| 299 | */ |
| 300 | static 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 | /* |