Re: Issues with factorial operator - Mailing list pgsql-hackers

From Cui Shijun
Subject Re: Issues with factorial operator
Date
Msg-id 306760850706082311q190df4d1u58e090b67705cf0b@mail.gmail.com
Whole thread Raw
In response to Re: Issues with factorial operator  ("Dann Corbit" <DCorbit@connx.com>)
Responses Re: Issues with factorial operator  ("Dann Corbit" <DCorbit@connx.com>)
List pgsql-hackers
Hi,

2007/6/9, Dann Corbit <DCorbit@connx.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


pgsql-hackers by date:

Previous
From: "Dann Corbit"
Date:
Subject: Re: Autovacuum launcher doesn't notice death of postmaster immediately
Next
From: "Dann Corbit"
Date:
Subject: Re: Issues with factorial operator