[Zope] Going CRAZY from division

Charlie Reiman creiman@kefta.com
Mon, 18 Nov 2002 14:37:34 -0800


Probably python's pathological division paradox. Try:

"float(clicks)/float(views)"

Might also work and get the 100 in there:

"(100.0*clicks)/views"

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of BZ
> Sent: Monday, November 18, 2002 2:17 PM
> To: zope@zope.org
> Subject: [Zope] Going CRAZY from division
> 
> 
> I have two integers "clicks" and "views" and am trying to find what the
> ratio of clicks to views. This should be (and is on my calculator)
> 
> clicks / views * 100   (to get the percent)
> 3 / 356 * 100 = .842 %
> 
> <dtml-var expr="clicks/views">  Returns = 0
> 
> <dtml-var expr="clicks/views" fmt="%.6f"> Returns 0.00000
> 
> I don't know what is wrong. Anyone?
> 
> BZ
> 
> 
> 
> 
> _______________________________________________
> 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 )
>