Andy McKay <[EMAIL PROTECTED]> wrote:
> 
> <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?

Note the following::

 $ python
 Python 1.5.2 (#1, Feb  1 2000, 16:32:16)  [GCC egcs-2.91.66 1...
 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
 >>> 3/2
 1
 >>> 3.0/2
 1.5

Python performs integer division when handed integer arguments;
you need::

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

  <dtml-var "_.float( x )/2" fmt="%.2d">

or equivalent.

Tres.
--
===============================================================
Tres Seaver                                [EMAIL PROTECTED]
Digital Creations     "Zope Dealers"       http://www.zope.org

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
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 )

Reply via email to