lua-users home
lua-l archive

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


Shmuel Zeigerman <shmuz@bezeqint.net> writes:

> 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;

If you really want to split hairs, "buggy" is not wrong even though it
put me on the wrong track.  It means "does not work as intended" as
opposed to "broken", "cannot work as intended".

Anyway, oops.  But your "shortened version" still was something quite
different rather than being just shortening.

I do sound like a sassy child right now, don't I?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum