Re: factorial of negative numbers - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: factorial of negative numbers
Date
Msg-id CAEZATCVyX+QtVMLKrktwrbtbRRR70n6-Bt5QXh+g8fiGE9n3hQ@mail.gmail.com
Whole thread Raw
In response to Re: factorial of negative numbers  (Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>)
Responses Re: factorial of negative numbers  (Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>)
Re: factorial of negative numbers  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
On Tue, 16 Jun 2020 at 10:09, Juan José Santamaría Flecha
<juanjo.santamaria@gmail.com> wrote:
>
> It is defined as NaN (or undefined), which is not in the realm of integer numbers. You might get a clear idea of the
logicfrom [1], where they also make a case for the error being ERRCODE_DIVISION_BY_ZERO. 
>
> [1] http://mathforum.org/library/drmath/view/60851.html
>

Hmm, I think ERRCODE_DIVISION_BY_ZERO should probably be reserved for
actual division functions.

With [1], we could return 'Infinity', which would be more correct from
a mathematical point of view, and might be preferable to erroring-out
in some contexts.

[1] https://www.postgresql.org/message-id/606717.1591924582%40sss.pgh.pa.us

Regards,
Dean



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: factorial of negative numbers
Next
From: Amit Kapila
Date:
Subject: Re: Parallel copy