Pedro Gimeno <pgsql-004(at)personal(dot)formauri(dot)es> writes:
> The previous version left out a corner case. Attached is a function and
> test suite to deal with it.
Hmm ... I'm thinking we probably should explicitly check for inf and NaN,
no?
if (isnan(x) || isinf(x))
return x;
It's possible the given coding would return this result anyway by
accident, but that seems rather fragile.
regards, tom lane