lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


David Kastrup wrote:
You're right with regards to overflow. Your version of floor is
however buggy.

How so?  Can you give an example where it would fail?  The only
assumptions my version makes is that (double)(int)x is integral and that
abs(x-(int)x) < 1.0 which is rather reasonable.

I'm sorry to have used the word "buggy". I think that was just a typo from your side:

-  return y > x ? y-1.0 : x;
+  return y > x ? y-1.0 : y;
--
Shmuel