Re: Bug #534: factorial function - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #534: factorial function
Date
Msg-id 23148.1008002264@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bug #534: factorial function  (Thomas Lockhart <lockhart@fourpalms.org>)
Responses Re: Bug #534: factorial function  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-bugs
Thomas Lockhart <lockhart@fourpalms.org> writes:
>> ... I'd be sorely tempted to replace all three by a single
>> function that takes integer and returns numeric.

> Yikes. Although numeric is theoretically nice, it is hundreds of times
> slower than native doubles.

(a) As a wise man once said, "I can make it arbitrarily fast, if it
doesn't have to give the right answer".  (b) The factorial function
doesn't strike me as a performance bottleneck.  (c) I have no objection
to offering a double-precision-based gamma function alongside the
integer factorial function.  But I think factorial should give an exact
answer as far as is possible before it overflows.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: Bug #534: factorial function
Next
From: "Janko F. Richter"
Date:
Subject: Re: Bug #534: factorial function