[Zope] Square Roots... Please help sqrt(x)

Tino Wildenhain tino@wildenhain.de
Thu, 12 Dec 2002 20:47:52 +0100


Hi Richard,

--On Donnerstag, 12. Dezember 2002 13:04 -0500 Richard Shebora 
<richard@apogaion.com> wrote:

> To anyone who may be able to help,
>
> I need to calculate the distance between two zip codes and all is working
> except for the square root part.
>
> I have been trying to use
>
> <dtml-var expr="_.sqrt(x)">
>
> to get the square root of x.  But it does not work and reports an
> attribute error.  I have used the _.int(x) with no problem and dis notice
> the sqrt() is in the Math Library.  Is there additional syntax to access
> this function?  I searched and googled and found everything but an
> example in DTML of how to use sqrt().

See 
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixA.stx
especially the part about "modules"

in DTML its just _.math.sqrt(x)

in Python Scripts:

import math

math.sqrt(x)

Regards
Tino