BUG #2037: user function call unexpected "input out of range" - Mailing list pgsql-bugs

From Tom
Subject BUG #2037: user function call unexpected "input out of range"
Date
Msg-id 20051111212647.381D3F0CD9@svr2.postgresql.org
Whole thread Raw
Responses Re: BUG #2037: user function call unexpected "input out of range"  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #2037: user function call unexpected "input out of range"  (Michael Fuhr <mike@fuhr.org>)
Re: BUG #2037: user function call unexpected "input out of range"  (tomas@tuxteam.de (Tomas Zerolo))
Re: BUG #2037: user function call unexpected "input out of range"  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      2037
Logged by:          Tom
Email address:      lackey@ltu.edu
PostgreSQL version: 8.1-beta4
Operating system:   Windows XP
Description:        user function call unexpected "input out of range"
Details:

--No database needs to be selected.
--Just cut and paste into a file.
--All remarks are in comments.
--
--From the psql prompt use "\i fileName".
--
create function  find (numeric,numeric,numeric,numeric) returns double
precision
as
    $$

        --Calculate distance
        select     acos
            (
                sin($1*pi()/180)*sin($3*pi()/180)
                +
                cos($1*pi()/180)*cos($3*pi()/180)
*cos(($2-$4)*pi()/180)
            )*60*1.1515*180/pi();



    $$
language SQL;

--Number 1.
select find(42.3202,-83.2687,42.3202,-83.2687);
--Number 2.
select find(42.320,-83.2687,42.3202,-83.2687);
--Number 3.
select find(42.3338,-83.1818,42.3338,-83.1818);

\df+ find;
drop function find(numeric,numeric,numeric,numeric);


/* This surfaced when calculating the distances between zip codes using
latidtudes and longitudes. When the latitudes and longitudes are the same
the distance should be zero. Number 1 gives the error. Number 2 differs by a
digit in the last decimal place and works. Number 3 is another test with
identical latitudes and longitudes and does calculate zero.

The "DROP FUNCTION" was only put in so I could repeatly re-execute the
script.


The ".msi" was used for the install accepting all of the defaults.

Thanks, Tom

*/

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: storage sync failed on magnetic disk: Permission denied
Next
From: Tom Lane
Date:
Subject: Re: BUG #2037: user function call unexpected "input out of range"