Re: Problem in

Поиск
Список
Период
Сортировка
Искать
От
Andrej
Тема
Re: Problem in
Дата
Msg-id
CACMx3pMZos=m9rPhwKMANcTqRY5LfBWrpx85G0MG4-595v8O5A@mail.gmail.com
Ответ на
Re: Problem in (Max Lipsky)
Список
Дерево обсуждения
Problem in Max Lipsky <maxlipsky@gmail.com>
Re: Problem in Tom Lane <tgl@sss.pgh.pa.us>
Re: Problem in Max Lipsky <maxlipsky@gmail.com>
Re: Problem in Tom Lane <tgl@sss.pgh.pa.us>
Re: Problem in Andrej <andrej.groups@gmail.com>
Re: Problem in Max Lipsky <maxlipsky@gmail.com>
Re: Problem in Jean-David Beyer <jeandavid8@verizon.net>
Re: Problem in Javin Paul <savingfunda@gmail.com>
Re: Problem in Charles Sheridan <cesheri@swbell.net>
Unsubscribing from list (was: Problem in David W Noon <david.w.noon@googlemail.com>
Re: Unsubscribing from list (was: Problem in David W Noon <david.w.noon@googlemail.com>
Max, just try

SELECT 1 - ( 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;

You may find that enlightening.  I did play with this for a while
yesterday (and asked people on IRC), and it seems to heavily depend
the on local systems set-up.
Seems that e.g. MacOS mojave & postgres9.6 from brew work as you
expect; someone confirmed postgres on Suse to do the right thing.
9.6.15 on Ubuntu 16.04
gives a remainder that would then make the acos fail ...

On Fri, 26 Apr 2019 at 19:24, Max Lipsky  wrote:
>
> Hello Tom!
>
> I think is too much for roundoff error
>
> Found funny post about it:
> https://randomascii.wordpress.com/2014/10/09/intel-underestimates-error-bounds-by-1-3-quintillion/
> http://notabs.org/fpuaccuracy/index.htm
>
>
>
> On 25 Apr 2019, at 19:56, Tom Lane  wrote:
>
> Max Lipsky  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
>
>


-- 
Please don't top post, and don't use HTML e-Mail :}  Make your quotes concise.

http://www.georgedillon.com/web/html_email_is_evil.shtml
http://www.catb.org/jargon/html/email-style.html


В списке pgsql-sql по дате отправления
От: Tom Lane
Дата:
Сообщение: Re: Problem in
От: Max Lipsky
Дата:
Сообщение: Re: Problem in
FAQ