Hi, 2007/6/9, Dann Corbit <[EMAIL PROTECTED]>:
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 ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org