Re: ceiling function

Posted by Gabriel Landini on
URL: http://imagej.273.s1.nabble.com/ceiling-function-tp3683582p3683589.html

On Sunday 07 Aug 2011, Dscho wrote:

> On Sun, 7 Aug 2011, Albert Cardona wrote:
> > 2011/8/7 Wes Armour <[hidden email]>:
> > > I am writing an imagej macro. In it I need to round up to the nearest
> > > integer e.g. 2.1 -> 3 Normally this can be done with the ceiling
> > > function, is there a function like this in imagej macro language??
> > > I've found round and floor, but no ceil.
> >
> > So you could add 1 and then call floor ?
>
> Or -floor(-x).

Yes, that one might be better.  Ceiling as floor(x +1)  does not work for x=0;
it returns 1 instead of 0.

Cheers
Gabriel