[Zope] dtml decimals
Andy McKay
andym@ActiveState.com
Wed, 13 Dec 2000 12:59:57 -0800
Yup, the implication there is that I am doing a 3/2, im not, that was an
example. Im using variables and hence its easiest to cast one of them as a
float is easier than adding .0 on to the end...
Cheers.
--
Andy McKay, Developer.
ActiveState.
----- Original Message -----
From: "Dyon Balding" <dyon@devcoder.com.au>
To: "Andy McKay" <andym@activestate.com>
Cc: "zope-misc" <zope@zope.org>
Sent: Wednesday, December 13, 2000 12:38 PM
Subject: Re: [Zope] dtml decimals
> 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>
>
> _______________________________________________
> 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 )
>