Numeric version of factorial()

Поиск
Список
Период
Сортировка
Искать
От
Gavin Sherry
Тема
Numeric version of factorial()
Дата
Msg-id
Pine.LNX.4.21.0308011020560.12997-200000@linuxworld.com.au
Список
Дерево обсуждения
Numeric version of factorial() Gavin Sherry <swm@linuxworld.com.au>
Re: Numeric version of factorial() Bruce Momjian <pgman@candle.pha.pa.us>
Re: Numeric version of factorial() Tom Lane <tgl@sss.pgh.pa.us>
Re: Numeric version of factorial() Gavin Sherry <swm@linuxworld.com.au>
Re: Numeric version of factorial() Tom Lane <tgl@sss.pgh.pa.us>
Re: Numeric version of factorial() Gavin Sherry <swm@linuxworld.com.au>
Re: Numeric version of factorial() Bruce Momjian <pgman@candle.pha.pa.us>
Attached is a patch implementing factorial(), returning numeric. Points to
note:

1) arttype is numeric. I thought this was the best way of allowing
arbitarily large factorials, even though factorial(2^63) is a large
number. Happy to change to integers if this is overkill.
2) since we're accepting numeric arguments, the patch tests for floats. If
a numeric is passed with non-zero decimal portion, an error is raised
since (from memory) they are undefined.
3) I have not removed factorial([int2|int4|int8]), not their operator
counterparts since I didn't know what people would want done with these.
4) I haven't added any documentation but am happy to once I know if people
want int or numeric arguments.

Thanks,

Gavin
В списке pgsql-patches по дате отправления
От: Troels Arvin
Дата:
От: Tom Lane
Дата:
FAQ