Login  Register

Re: ceiling function

Posted by dscho on Aug 08, 2011; 8:17am
URL: http://imagej.273.s1.nabble.com/ceiling-function-tp3683582p3683591.html

Hi Kees,

On Mon, 8 Aug 2011, Straatman, Kees R. (Dr.) wrote:

> Why not floor(x)?
>
> As far as I can see there is no difference in the results. Is there a
> special reason to put -floor(-x)?

Try this:

        print(-floor(-5.5));
        print(floor(5.5));

In other words, floor(x) rounds down, while -floor(-x) rounds up.

Ciao,
Johannes