Re: gamma() and lgamma() functions

2025-03-26 Thread Marcos Pegoraro
Em qua., 26 de mar. de 2025 às 08:58, Marcos Pegoraro escreveu: > func.sgml doesn't mention lgamma function, so users will think just gamma > exists, is that correct ? > Sorry, it's my fault. I didn't read the entire file. regards Marcos

Re: gamma() and lgamma() functions

2025-03-26 Thread Marcos Pegoraro
Em qua., 26 de mar. de 2025 às 06:50, Dean Rasheed escreveu: > OK, thanks. I've updated that comment and committed it. func.sgml doesn't mention lgamma function, so users will think just gamma exists, is that correct ? regards Marcos

Re: gamma() and lgamma() functions

2025-03-26 Thread Dean Rasheed
On Tue, 25 Mar 2025 at 05:01, Alexandra Wang wrote: > > I reviewed the patch and it looks good to me. I’ve run some tests, and > everything works as expected. Thanks for the careful review and testing. > Raising an error instead of silently returning Inf for invalid inputs > like zero, negative

Re: gamma() and lgamma() functions

2025-03-24 Thread Alexandra Wang
Hi Dean, Thanks for the patch! I reviewed the patch and it looks good to me. I’ve run some tests, and everything works as expected. I have one minor thought: On Sun, Mar 2, 2025 at 2:30 AM Dean Rasheed wrote: > On Thu, 14 Nov 2024 at 22:35, Dean Rasheed > wrote: > > > > On Thu, 14 Nov 2024 a

Re: gamma() and lgamma() functions

2025-03-02 Thread Dean Rasheed
On Thu, 14 Nov 2024 at 22:35, Dean Rasheed wrote: > > On Thu, 14 Nov 2024 at 16:28, Dmitry Koval wrote: > > > > >SELECT gamma(float8 '1e-320'); > > ERROR: value out of range: overflow > > > > >SELECT gamma(float8 '0'); > >gamma > > -- > > Infinity > > (1 row) > > > > Perhaps it w

Re: gamma() and lgamma() functions

2024-11-14 Thread Dean Rasheed
On Thu, 14 Nov 2024 at 16:28, Dmitry Koval wrote: > > I think having gamma() and lgamma() functions in PostgreSQL would be > useful for some users, this is asked [1]. > Thanks for looking. > >SELECT gamma(float8 '1e-320'); > ERROR: value out of range: overflow > > >SELECT gamma(float8 '0'); >

Re: gamma() and lgamma() functions

2024-11-14 Thread Dmitry Koval
Hi! I think having gamma() and lgamma() functions in PostgreSQL would be useful for some users, this is asked [1]. I have a question regarding the current implementation of gamma() function. Code block: + if (errno == ERANGE && arg1 != 0) + { + if (result != 0.0) +

Re: gamma() and lgamma() functions

2024-09-06 Thread Dean Rasheed
On Fri, 6 Sept 2024 at 10:42, Dean Rasheed wrote: > > ... assuming that tgamma() and lgamma() behave according to spec ... Nope, that was too much to hope for. Let's see if this fares any better. Regards, Dean diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml new file mode 100644 inde

Re: gamma() and lgamma() functions

2024-09-06 Thread Dean Rasheed
On Wed, 4 Sept 2024 at 19:21, Tom Lane wrote: > > >> I'm not sure why you are doing the testing for special values (NaN etc.) > >> yourself when the C library function already does it. For example, if I > >> remove the isnan(arg1) check in your dlgamma(), then it still behaves > >> the same in al

Re: gamma() and lgamma() functions

2024-09-04 Thread Tom Lane
I wrote: > AFAICS this patch doesn't inspect signgam, so whether it gets > overwritten by a concurrent thread wouldn't matter. However, > it'd be a good idea to add a comment noting the hazard. Further to that ... I looked at POSIX issue 8 (I had been reading 7) and found this illuminating discus

Re: gamma() and lgamma() functions

2024-09-04 Thread Tom Lane
Dean Rasheed writes: > On Fri, 23 Aug 2024 at 13:40, Peter Eisentraut wrote: >> What are examples of where this would be useful in a database context? > Of course, there's a somewhat fuzzy line between what is generally > useful enough, and what is too specialised for core Postgres, but I > woul

Re: gamma() and lgamma() functions

2024-09-04 Thread Dean Rasheed
On Fri, 23 Aug 2024 at 13:40, Peter Eisentraut wrote: > > What are examples of where this would be useful in a database context? gamma() and lgamma() are the kinds of functions that are generally useful for a variety of tasks like statistical analysis and combinatorial computations, and having th

Re: gamma() and lgamma() functions

2024-08-23 Thread Peter Eisentraut
On 01.07.24 12:33, Dean Rasheed wrote: Attached is a patch adding support for the gamma and log-gamma functions. See, for example: https://en.wikipedia.org/wiki/Gamma_function I think these are very useful general-purpose mathematical functions. They're part of C99, and they're commonly include

Re: gamma() and lgamma() functions

2024-07-02 Thread Dean Rasheed
On Mon, 1 Jul 2024 at 16:04, Alvaro Herrera wrote: > > On 2024-Jul-01, Stepan Neretin wrote: > > > I have one notice: > > ERROR: value out of range: overflow. I think we need to add information > > about the available ranges in the error message > > I think this is a project of its own. The erro

Re: gamma() and lgamma() functions

2024-07-01 Thread Alvaro Herrera
On 2024-Jul-01, Stepan Neretin wrote: > I have one notice: > ERROR: value out of range: overflow. I think we need to add information > about the available ranges in the error message I think this is a project of its own. The error comes from calling float_overflow_error(), which is a generic ro

Re: gamma() and lgamma() functions

2024-07-01 Thread Stepan Neretin
On Mon, Jul 1, 2024 at 5:33 PM Dean Rasheed wrote: > Attached is a patch adding support for the gamma and log-gamma > functions. See, for example: > > https://en.wikipedia.org/wiki/Gamma_function > > I think these are very useful general-purpose mathematical functions. > They're part of C99, and

Re: gamma() and lgamma() functions

2024-07-01 Thread Daniel Gustafsson
> On 1 Jul 2024, at 16:20, Stepan Neretin wrote: > The patch file seems broken. > git apply gamma-and-lgamma.patch error: git apply: bad git-diff — exptec > /dev/null in line 2 It's a plain patch file, if you apply it with patch and not git it will work fine: $ patch -p1 < gamma-and-lgamma.p

Re: gamma() and lgamma() functions

2024-07-01 Thread Stepan Neretin
On Mon, Jul 1, 2024 at 5:33 PM Dean Rasheed wrote: > Attached is a patch adding support for the gamma and log-gamma > functions. See, for example: > > https://en.wikipedia.org/wiki/Gamma_function > > I think these are very useful general-purpose mathematical functions. > They're part of C99, and