Re: Bug #534: factorial function

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Bug #534: factorial function
Дата
Msg-id 200112101121.fBABLgI23940@candle.pha.pa.us
обсуждение исходный текст
Ответ на Bug #534: factorial function  (pgsql-bugs@postgresql.org)
Ответы Re: Bug #534: factorial function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Yep, 0! sure looks like a bug.  We will fix it in 7.3.  Not sure about
the double precision.  Comments?

---------------------------------------------------------------------------

> Janko Richter (j.richter@wallstreet-develop.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
bigintproduces 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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Bug #532: backend crashes due to segmentation fault
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bug #531: libpq: Operations following PQfinish() work.