On Sat, 2004-05-15 at 11:52, Tom Lane wrote:
> But the spec hasn't even got log(), so it can hardly be thought to be
> taking a position on what error codes log() should return. I think
> log() should use the same error codes as ln().
Point taken, I've made this change.
> You might consider changing the explication of the state code to INVALID
> ARGUMENT FOR LOGARITHM, omitting the word NATURAL.
Done.
> I don't think trunc() is portable ... we certainly don't use it anywhere
> else. May I suggest rint() instead? Or floor()?
trunc() is C99, but we may as well use floor(), which is C89.
I've attached a revised patch. It incorporates your suggestions, and
makes one additional change: the SQL standard defines sqrt(x) as
power(x, 0.5) -- therefore, ISTM that sqrt(-whatever) should emit the
"invalid argument to power function" SQLSTATE code.
Barring any objections, I'll apply this patch tonight (... or as soon as
CVS is back up).
-Neil