On Sat, Aug 9, 2014 at 1:40 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
__x = result_type(2.0) * __aurng() - 1.0;
You're right, we of course need the negatives as well.
Assuming the 2 coordinates are obtained through a rescaling x->2*x-1, if
__sq is not exactly 0, it must be between 2^-103 and 1 (for ieee
double), so I am not sure hypot gains that much (at least in my mind
hypot was mostly a gain close to 0 or infinity, but maybe it has more
advantages). It can only hurt speed though, so not a big issue.
Depending on how similar in size the two values are, not using hypot()
can drop quite a few bits. Especially with the scaling through
division this error can be noticeable. Better be sure. Maybe at some
point I have time to investigate the worst case scenario for the
numbers in question but until this shows hypot isn't needed it's best
to leave it in.
I've committed the patch.