Re: factorial of negative numbers
От | Juan José Santamaría Flecha |
---|---|
Тема | Re: factorial of negative numbers |
Дата | |
Msg-id | CAC+AXB2mQvAiXoBffX=xbmovTBjqGmuYOpGW-osmRiyt9gqK1Q@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: factorial of negative numbers (Bruce Momjian <bruce@momjian.us>) |
Ответы |
Re: factorial of negative numbers
|
Список | pgsql-hackers |
On Tue, Jun 16, 2020 at 10:55 AM Bruce Momjian <bruce@momjian.us> wrote:
On Tue, Jun 16, 2020 at 08:31:21AM +0100, Dean Rasheed wrote:
>
> Most common implementations do regard factorial as undefined for
> anything other than positive integers, as well as following the
> convention that factorial(0) = 1. Some implementations extend the
> factorial to non-integer inputs, negative inputs, or even complex
> inputs by defining it in terms of the gamma function. However, even
> then, it is undefined for negative integer inputs.
Wow, they define it for negative inputs, but not negative integer
inputs? I am curious what the logic is behind that.
It is defined as NaN (or undefined), which is not in the realm of integer numbers. You might get a clear idea of the logic from [1], where they also make a case for the error being ERRCODE_DIVISION_BY_ZERO.
Regards,
Juan José Santamaría Flecha
В списке pgsql-hackers по дате отправления: