[Zope] Going CRAZY from division
Chris Beaven
chris@d-designz.co.nz
Wed, 20 Nov 2002 14:41:48 +1300
And it seems that the order of division over multiplication doesn't
really matter...
>>> 3*100.0/356 == 3/356.0*100
1
Tino Wildenhain wrote:
>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
>
>_______________________________________________
>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 )
>
>
>