Skip site navigation (1) Skip section navigation (2)

Bug #534: factorial function

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #534: factorial function
Date: 2001-12-10 09:34:22
Message-ID: 200112100934.fBA9YMJ91954@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Janko Richter (j(dot)richter(at)wallstreet-develop(dot)de) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
factorial function

Long Description
1. The factorial function returns 0 when the argument is 0. The factorial Funtion is defined as:  factorial(0)=1

2. It would be better to define a factorial function returning double precision. The factorial function returning bigint produces false values  with arguments larger then 20.

Notice: I'm using the factorial function for statistical functions (for example poisson distribution)

Thank you.


Sample Code
test=# select factorial(0);
 factorial 
-----------
         0
(1 row)

janko=# select factorial(21::bigint);
      factorial       
----------------------
 -4249290049419214848
(1 row)




No file was uploaded with this report


Responses

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2001-12-10 10:25:50
Subject: Re: Bug #531: libpq: Operations following PQfinish() work.
Previous:From: Hiroshi InoueDate: 2001-12-10 07:38:57
Subject: Re: Bug #533: BLOB (lo type) objects could not be restored

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group