replacing a formula from a string

J

Josselin

I have a long formula expressed as a string

formula_1 = "6366.00 * Math.acos(Math.cos(self.latitude) *
Math.cos(latitude) * Math.cos(longitude -self.longitude) +
(Math.sin(self.latitude) * Math.sin(LatitudeRad)) )"

I need to use it in the preparation of some SQL query conditions like :

condition += (c:)villes){ 6366.00 * Math.acos(Math.cos(self.latitude) *
Math.cos(latitude) * Math.cos(longitude -self.longitude) +
(Math.sin(self.latitude) * Math.sin(LatitudeRad)) ) < distance } )

How could I write it only once 'formula_1' and reuse it like :
condition += (c:)villes){ formula_1 < distance }) # this is wrong as
formula_1 is a string ..

thansk for your suggestions

joss
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,218
Messages
2,571,124
Members
47,727
Latest member
smavolo

Latest Threads

Top