Re: [GENERAL] input out of error with haversine formula

2010-10-17 Thread Dean Rasheed
On 16 October 2010 21:13, Vince Carney wrote: > Is it possible to do an if/else statement inside acos() to account for a > 1 > or < -1. I can't seem to get if/else working in postgres? > Try to stay on-list, so that others can benefit from the discussion. Yes you could use CASE..WHEN, but that w

Re: [GENERAL] input out of error with haversine formula

2010-10-15 Thread Dean Rasheed
On 15 October 2010 06:03, Vince Carney wrote: > The following will return an input out of error as the acos() function > cannot be -1 <= x <= 1. > SELECT * FROM >                 (SELECT *, (3959 * acos(cos(radians(37.7438640)) * > cos(radians(37.7438640)) * cos(radians(-97.4631299) - >           

[GENERAL] input out of error with haversine formula

2010-10-14 Thread Vince Carney
The following will return an input out of error as the acos() function cannot be -1 <= x <= 1. SELECT * FROM (SELECT *, (3959 * acos(cos(radians(37.7438640)) * cos(radians(37.7438640)) * cos(radians(-97.4631299) - radians(-97.4631299)) + sin(radians(37.7438640)) * s