[Zope] Going CRAZY from division

Tino Wildenhain tino@wildenhain.de
Wed, 20 Nov 2002 01:52:03 +0100


Hi,

--On Montag, 18. November 2002 17:17 -0500 BZ <bz@bwanazulia.com> 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 %
This one is basic numeric. Not that python (like many other languages)
uses integer operation if only integers are used. In this case you
want to change your term into

3*100/356

First multiplication and then division. This increases exactness.
(This is true for every fixed point arithmetik)

Regards
Tino