Integer division in Python is "floor division" with respect to the operands both being ints (dividing two ints results in an int). Python does "true division" when either operand is a float. You should change one or the other or both of "clicks" or "views" to a float to get a float back. HTH, - C On Mon, 2002-11-18 at 17:17, BZ wrote:
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 )