Numeric version of factorial()

From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: pgsql-patches(at)postgresql(dot)org
Subject: Numeric version of factorial()
Date: 2003-08-01 00:58:15
Message-ID: Pine.LNX.4.21.0308011020560.12997-200000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-patches

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

Attachment Content-Type Size
factorial.diff text/plain 5.9 KB

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Chad N. Tindel 2003-08-01 01:10:52 Mysql -> Postgresql pitfalls
Previous Message Cornelia Boenigk 2003-07-31 17:25:41 Re: [GENERAL] interesting PHP/MySQL thread

Browse pgsql-patches by date

  From Date Subject
Next Message Mark Kirkwood 2003-08-01 00:58:31 Re: Minor verbosity increase for analyze
Previous Message Mark Kirkwood 2003-07-31 22:05:57 Minor verbosity increase for analyze