On Thu, Feb 17, 2005 at 03:00:09PM +0100, [EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote on 17.02.2005 11:38:44:
> 
> > You can write a couple of simple macros to do it for you:
> > 
> > [% MACRO ceiling(n) 
> >     GET n + 1 
> >      FILTER format("%d");
> > 
> > 
> >    MACRO floor(n)
> >     GET n 
> >      FILTER format("%d"); 
> > %]
> > 
> > [% ceiling(1.5) %]   # round up
> > [% floor(1.5)   %]   # round down
> 
> [% ceiling(2) %]   # gives 3, rounded up to much.
> Or do I misinterpret something here?

You can change the macro to add 0.5 instead of 1.

But then that'll probably fail on negative numbers or something
like that :(

Dave...

-- 
  We are far too young and clever

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to