Tom Lane wrote, On 2015-03-25 18:57:
> 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.
I agree about NaN; it worked but mostly by accident. The big number
detection catches infinity unambiguously. Added to a comment in the
attached (plus corresponding tests).