[Zope] expression evaluateion

Tino Wildenhain tino@wildenhain.de
Thu, 16 Mar 2000 19:39:59 +0100


Hi Chien,

Chien-pin Wang wrote:
> 
> Hi,
> 
>     Zope seems to evaluate expressions in an unconventional way.
No, its all alright ;)

> Say I have three properties, a=3, b=5, c=7 set in a Folder. In
> a DTML Document I tried to say <dtml-var "a/b*c"> and got result
> 0. The expression was evaluated as a/(b*c) and rounded off. Is
> not the expression supposed to be evaluated as (a/b)*3? The
> result is not correct still if we put it this way:
> <dtml-var "(a/b)*3">. I still got 0 as the result. Did I miss
> anything fundamentally or is this a, bug?

No, its integer :)
3/5 is 0, anything multiplicated with 0 will be 0.
so 3/5*7 is 0 no matter where you set brackets :)
Integer does not round, it only cuts off everything after the "."

Eventually you want: a=3.0, b=5.0 and c=7.0
(even only one variable beeing "float" wuld be sufficient)

Hth
Tino Wildenhain