[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua without stdio?
- From: Shmuel Zeigerman <shmuz@...>
- Date: Wed, 13 Aug 2008 18:35:17 +0200
Luiz Henrique de Figueiredo wrote:
See http://lua-users.org/lists/lua-l/2008-05/msg00666.html for a sample
implementation with pointers to whatever is missing.
The implementation of floor works incorrectly for negative x.
The following seems to work OK:
double floor(double x)
if (x >= 0) return (double)(int)x;
y = (double)(int)(x-1);
return x - y == 1 ? x : y;