Re: factorial of negative numbers

From: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Ashutosh Bapat <ashutosh(dot)bapat(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: factorial of negative numbers
Date: 2020-06-18 07:43:54
Message-ID: CAC+AXB1AFZRYXL+qNdyJjYPEwZ01nUMij7wg2soKAcsBqDO3yA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 18, 2020 at 9:13 AM Peter Eisentraut <
peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:

> On 2020-06-16 14:17, Dean Rasheed wrote:
> > I think you're probably right though. Raising an out-of-range error
> > seems like the best option.
>
> committed as proposed then
>

The gamma function from math.h returns a NaN for negative integer values,
the postgres factorial function returns a numeric, which allows NaN.
Raising an out-of-range error seems only reasonable for an integer output.

Regards,

Juan José Santamaría Flecha

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-06-18 07:47:46 Re: Physical replication slot advance is not persistent
Previous Message Kyotaro Horiguchi 2020-06-18 07:36:11 Re: Review for GetWALAvailability()