BUG #5711: input out of error with haversine formual

Поиск
Список
Период
Сортировка
От Vince
Тема BUG #5711: input out of error with haversine formual
Дата
Msg-id 201010150458.o9F4wNcj092342@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5711: input out of error with haversine formual
Re: BUG #5711: input out of error with haversine formual
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5711
Logged by:          Vince
Email address:      vincecarney@gmail.com
PostgreSQL version: 8.4
Operating system:   Linux
Description:        input out of error with haversine formual
Details:

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)) *
sin(radians(37.7438640))))
                AS distance
                FROM foo) AS distances
                WHERE distance < 10
                ORDER BY distance

If I break this down the following returns 1:
SELECT (cos(radians(37.7438640)) * cos(radians(37.7438640)) *
cos(radians(-97.4631299) - radians(-97.4631299)) + sin(radians(37.7438640))
* sin(radians(37.743864000)));

acos(1) would give me 0.

Thoughts?

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: BUG #5682: Postgres Service crashes with exception 0xC0000135
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: BUG #5711: input out of error with haversine formual