[Zope] dtml decimals

Dyon Balding dyon@devcoder.com.au
Thu, 14 Dec 2000 07:38:25 +1100


or even simpler:

<dtml-var "3.0/2" fmt="%.2f">

the decimal point implies a floating point rather than an int.

-d

On Wed, Dec 13, 2000 at 12:23:19PM -0800, Andy McKay wrote:
> Well there you go:
> 
> <dtml-var "_.float(3)/_.float(2)" fmt="%.2f">
> 
> Its a python thing, it sees 3 and casts it as an int, same with 2 and
> dividing ints results in an int. You learn something new every day.
> 
> --
>   Andy McKay, Developer.
>   ActiveState.
> 
> ----- Original Message -----
> From: "Andy McKay" <andym@ActiveState.com>
> To: "zope-misc" <zope@zope.org>
> Sent: Wednesday, December 13, 2000 10:11 AM
> Subject: Re: [Zope] dtml decimals
> 
> 
> > Well for one thing that example should be <dtml-var "3/2" fmt="%.2f">
> > --
> >   Andy McKay, Developer.
> >   ActiveState.
> >
> > ----- Original Message -----
> > From: "Andy McKay" <andym@ActiveState.com>
> > To: "zope-misc" <zope@zope.org>
> > Sent: Wednesday, December 13, 2000 10:03 AM
> > Subject: [Zope] dtml decimals
> >
> >
> > > <dtml-var "3/2" fmt="%.2d"> instead of getting 1.50 as I was expecting I
> > get
> > > 1.00, I never seem to be getting decimals. Whats the obivous thing Im
> > > missing here?
> > >
> > > Cheers.
> > >
> > > --
> > >   Andy McKay, Developer.
> > >   ActiveState.
> > >
> > >
> > > _______________________________________________
> > > Zope maillist  -  Zope@zope.org
> > > http://lists.zope.org/mailman/listinfo/zope
> > > **   No cross posts or HTML encoding!  **
> > > (Related lists -
> > >  http://lists.zope.org/mailman/listinfo/zope-announce
> > >  http://lists.zope.org/mailman/listinfo/zope-dev )
> > >
> >
> >
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> >
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 
Dyon Balding <dyon@devcoder.com.au>