On 10 May 2016 at 08:31, Darren Duncan <darren at darrenduncan.net> wrote:

> The Ceiling function is not that simple, unless you know that your rank
> and outOf are always non-negative numbers.  If they might be negative, you
> would -1 rather than +1 when the result is negative. -- Darren Duncan
>

Yeah you can't always add one. But you never need to subtract one - ceil
always rounds towards positive infinity which is equivalent to integer
truncation over the range of negative reals.

I can't see a better way to implement ceil/floor in sqlite than using an
int cast to truncate.

-Rowan

Reply via email to