Re: Problem in - Mailing list pgsql-sql

From Javin Paul
Subject Re: Problem in
Date
Msg-id CAKGadqYnnvkiiR5cJXxJW1_3=sbr-g2xy455FA=XMDMr86We_A@mail.gmail.com
Whole thread Raw
In response to Re: Problem in  (Max Lipsky <maxlipsky@gmail.com>)
Responses Re: Problem in  (Charles Sheridan <cesheri@swbell.net>)
List pgsql-sql
Hello All,

I want to unsubscribe from this group, can anyone please guide? Sorry for the trouble. 

Regards
Javin

On Fri, Apr 26, 2019 at 3:24 PM Max Lipsky <maxlipsky@gmail.com> wrote:
Hello Tom!

I think is too much for roundoff error

Found funny post about it:



On 25 Apr 2019, at 19:56, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Max Lipsky <maxlipsky@gmail.com> writes:
SELECT acos(
          cos(radians(48.9193))
          * cos(radians(48.9193))
          * cos(radians(2.5431) - radians(2.5431))
          + sin(radians(48.9193))
            * sin(radians(48.9193))
      ) as result;

This returned [22003] ERROR: input is out of range

Not too surprising, because (at least on my machine)

regression=# select cos(radians(48.9193))
regression-#            * cos(radians(48.9193)) +  sin(radians(48.9193))
regression-#              * sin(radians(48.9193));
     ?column?      
--------------------
1.0000000000000002
(1 row)

Problems of this sort are inevitable when working with finite-precision
math.

https://en.wikipedia.org/wiki/Round-off_error

regards, tom lane



--

pgsql-sql by date:

Previous
From: Jean-David Beyer
Date:
Subject: Re: Problem in
Next
From: Charles Sheridan
Date:
Subject: Re: Problem in