From: | "Cui Shijun" <rancpine(at)gmail(dot)com> |
---|---|
To: | "Dann Corbit" <DCorbit(at)connx(dot)com> |
Cc: | "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Issues with factorial operator |
Date: | 2007-06-09 06:11:23 |
Message-ID: | 306760850706082311q190df4d1u58e090b67705cf0b@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
2007/6/9, Dann Corbit <DCorbit(at)connx(dot)com>:
> It makes sense with factorial function to do an error check on the
> domain. Calculate beforehand, and figure out what the largest sensible
> domain value is.
well, in fact what we need is to calculate log10(n!) first to see if
the result will get exceeded.
>
> For instance, in Maple, I get this:
> > y:=92838278!;
> Error, object too large
> >
>
> The error message returns instantly.
>
> For reasonably large values, it might make sense to pre-compute
> factorials and store them in an array.
>It should also be possible to
> store 1/2 of Pascal's triangle in memory and demand load that memory
> segment the first time someone asks for factorials or combinations or
> permutations.
there may be too much memories to waste in that case... :-(
Regards
CUI Shijun
From | Date | Subject | |
---|---|---|---|
Next Message | Dann Corbit | 2007-06-09 06:54:04 | Re: Issues with factorial operator |
Previous Message | Dann Corbit | 2007-06-09 05:55:52 | Re: Autovacuum launcher doesn't notice death of postmaster immediately |