Thread

  1. Re: [PATCH] Fix overflow and underflow in regr_r2()

    Tom Lane <tgl@sss.pgh.pa.us> — 2026-05-16T21:18:43Z

    Dean Rasheed <dean.a.rasheed@gmail.com> 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