simone - 1 year ago 302

SQL Question

I need to calculate an euclidean distance in a sqlite database.

Does anyone know how to calculate square roots in sqlite beside writing and loading a dynamic library for math functions?

I am close to resorting to the fast inverse square root algorithm in here http://en.wikipedia.org/wiki/Fast_inverse_square_root though it might to turn into more fun than I need right now.

And as a side note, it'd be great to figure out how to do power (which is the generalized question, and is cleaner coding than multiplying a number by itself).

Thanks,

Simone

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

Well, I have a semi-answer.

Yes it involves a 3rd party, but you don't have to write it yourself : did you check the last extension on this page ?

It includes several math functions, and amongst them is sqrt().