Re: [Templates] rounding numbers

[prev] [thread] [next] [Date index for 2005/02/17]

From: Harald Joerg
Subject: Re: [Templates] rounding numbers
Date: 14:52 on 17 Feb 2005
Shanta McBain asks:

> I have a need  to round number. Found some code in the archives to truncate 
> number to 2 or more decimals. I need to roundup and rounddown. Is there a way 
> to do this in ttml?

Despite all the previous suggestions:

Wouldn't just the 'format' filter do the trick?

[% x = 123.55501 %]
[% x | format('%.2f') %]

prints 123.56, as I would expect....
        -- 
        Cheers,
haj

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

[Templates] rounding numbers
Shanta McBain 05:15 on 17 Feb 2005

Re: [Templates] rounding numbers
Andy Wardley 10:38 on 17 Feb 2005

Re: [Templates] rounding numbers
merlyn (Randal L. Schwartz) 13:58 on 17 Feb 2005

Re: [Templates] rounding numbers
Andy Wardley 14:22 on 17 Feb 2005

Re: [Templates] rounding numbers
Matthias.Dillier 14:00 on 17 Feb 2005

Re: [Templates] rounding numbers
Dave Cross 14:10 on 17 Feb 2005

Re: [Templates] rounding numbers
merlyn (Randal L. Schwartz) 17:42 on 17 Feb 2005

Re: [Templates] rounding numbers
Igor Lobanov 14:11 on 17 Feb 2005

Re: [Templates] rounding numbers
Perrin Harkins 14:10 on 17 Feb 2005

Re: [Templates] rounding numbers
Harald Joerg 14:52 on 17 Feb 2005

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52