Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance
Дата
Msg-id CAEZATCUVK18HxMp4Xz_XuGKNZiKG05oPHTvkVYGMdKFuo4XYDg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance
Список pgsql-hackers
On Sun, 3 Feb 2019 at 15:12, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> > The spec doesn't require the inverse functions (asinh, acosh, atanh),
> > but surely there is no principled reason to omit them?
>
> +1 --- AFAICS, the C library has offered all six since C89.
>

+1 for including the inverse functions. However, it looks to me like
the inverse functions are C99-specific, so they might not be available
on all supported platforms. If they're not, we may need to provide our
own implementations.

I did a bit of research and had play. It looks like it might not be
too hard to provide our own implementations, but it does take a bit of
care to avoid rounding and overflow errors. Attached are some
standalone C programs where I tested various algorithms. A decent
approach seems to be to either use log1p() (which is itself
C99-specific, hence that's the first thing I played with) or to use a
single round of Newton-Raphson to correct rounding errors, in a
similar way to how we implement cbrt() on platforms that don't have
that.

Of course that may all be moot -- those functions may in fact be
available everywhere we care about, but it was interesting to play
around with them anyway.

Regards,
Dean

Вложения

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Fix optimization of foreign-key on update actions
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: monitoring CREATE INDEX [CONCURRENTLY]