Re: Bug #534: factorial function

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Bug #534: factorial function
Дата
Msg-id 200112292040.fBTKeDr04534@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Bug #534: factorial function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
> Thomas Lockhart <lockhart@fourpalms.org> writes:
> >> ... I'd be sorely tempted to replace all three by a single
> >> function that takes integer and returns numeric.
>
> > Yikes. Although numeric is theoretically nice, it is hundreds of times
> > slower than native doubles.
>
> (a) As a wise man once said, "I can make it arbitrarily fast, if it
> doesn't have to give the right answer".  (b) The factorial function
> doesn't strike me as a performance bottleneck.  (c) I have no objection
> to offering a double-precision-based gamma function alongside the
> integer factorial function.  But I think factorial should give an exact
> answer as far as is possible before it overflows.

float8 is the wrong way to go with factorial.  It is imprecise and only
goes to 69!.  Numeric seems like the way to go with this function.

Added to TODO:

    * Change factorial to return a numeric

--
  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 по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: Bug #545: Keyword USER not detected in CREATE VIEW
Следующее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #546: un-pg_restore-able pg_dump