From: | Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Numeric version of factorial() |
Date: | 2003-08-01 01:57:03 |
Message-ID: | Pine.LNX.4.21.0308011155340.18801-100000@linuxworld.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-patches |
On Thu, 31 Jul 2003, Tom Lane wrote:
> Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > 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.
>
> There is a standard mathematical definition for it (gamma function,
> IIRC) but this is probably plenty good enough for our purposes. I would
> suggest though that you reject fractions before you short-circuit for
> x <= 1.
Oops.
>
> > 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.
>
> We had already decided to nuke the int2 and int4 versions, since they
> overflow far too easily. I'd go with nuking int8 too and providing only
> the numeric variant ...
What are your feelings about numeric argument vs. int4/int8 arguments?
>
> > + int8_to_numericvar((int64)1, &one);
> > +
> > + ret = cmp_var(&fact, &one);
>
> Uh, why not use const_one?
Umm.. didn't notice it :-).
Thanks,
Gavin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-08-01 02:08:01 | Re: Numeric version of factorial() |
Previous Message | Tom Lane | 2003-08-01 01:37:44 | Re: Numeric version of factorial() |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-08-01 02:08:01 | Re: Numeric version of factorial() |
Previous Message | Tom Lane | 2003-08-01 01:37:44 | Re: Numeric version of factorial() |