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

Re: [PATCHES] Numeric version of factorial()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: PostgreSQL-documentation <pgsql-docs(at)postgresql(dot)org>
Subject: Re: [PATCHES] Numeric version of factorial()
Date: 2003-12-01 21:54:28
Message-ID: 200312012154.hB1LsSn15127@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-docspgsql-patches
I had to remove the factorial example from the casting docs because
factorial is now defined only for numeric.  Would someone take the
attached example and make a new one with a different operator?  

Thanks.

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

Gavin Sherry wrote:
> 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

Content-Description: 

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>       message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-docs by date

Next:From: Tom LaneDate: 2003-12-02 00:27:36
Subject: Re: [PATCHES] Numeric version of factorial()
Previous:From: Bruce MomjianDate: 2003-12-01 21:36:06
Subject: Re: Numeric version of factorial()

pgsql-patches by date

Next:From: Bruce MomjianDate: 2003-12-01 21:59:32
Subject: Re: Minor lmgr code cleanup
Previous:From: Bruce MomjianDate: 2003-12-01 21:48:32
Subject: Re: export FUNC_MAX_ARGS as a read-only GUC variable

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