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
Ответ на
Список
Дерево обсуждения
[Patch] Log10 and hyperbolic functions for SQL:2016 compliance Lætitia Avrot <laetitia.avrot@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 Lætitia Avrot <laetitia.avrot@gmail.com>
Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance Lætitia Avrot <laetitia.avrot@gmail.com>
Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance Alvaro Herrera <alvherre@2ndquadrant.com>
Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance Lætitia Avrot <laetitia.avrot@gmail.com>
Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance Andrew Gierth <andrew@tao11.riddles.org.uk>
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 Lætitia Avrot <laetitia.avrot@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 Lætitia Avrot <laetitia.avrot@gmail.com>
Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance Darafei "Komяpa" Praliaskouski <me@komzpa.net>
Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance Gavin Flower <GavinFlower@archidevsys.co.nz>
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 Dean Rasheed <dean.a.rasheed@gmail.com>
Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance Tom Lane <tgl@sss.pgh.pa.us>
On Sun, 3 Feb 2019 at 15:12, Tom Lane  wrote:
>
> Andrew Gierth  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
Дата:
От: Alvaro Herrera
Дата:
FAQ