Re: ceiling function
Posted by
Krs5 on
Aug 08, 2011; 8:08am
URL: http://imagej.273.s1.nabble.com/ceiling-function-tp3683582p3683590.html
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)?
Kees
-----Original Message-----
From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of Gabriel Landini
Sent: 07 August 2011 13:57
To:
[hidden email]
Subject: Re: ceiling function
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