From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Max Lipsky <maxlipsky(at)gmail(dot)com> |
Cc: | pgsql-sql(at)lists(dot)postgresql(dot)org |
Subject: | Re: Problem in |
Date: | 2019-04-25 16:56:46 |
Message-ID: | 26108.1556211406@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Max Lipsky <maxlipsky(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Max Lipsky | 2019-04-25 21:08:27 | Re: Problem in |
Previous Message | Max Lipsky | 2019-04-25 13:45:18 | Problem in |