Dean Rasheed <[email protected]> writes:
> I just had a thought: a simpler (and probably faster and more
> accurate) solution would be to use frexp() and ldexp(), which are both
> part of C99, so ought to be OK.

Seems like a plan.  We're already relying on ldexp() in pg_prng.c,
so I doubt there's a portability issue.  Reading the man page for
frexp(), we might want to special-case Inf and NaN inputs to avoid
assuming what it will do with those.  But that would only be needed
in the slow path where we're recovering from overflow/underflow.

                        regards, tom lane


Reply via email to