On Sun, Aug 10, 2014 at 2:00 AM, Ulrich Drepper <drep...@gmail.com> wrote: > On Sat, Aug 9, 2014 at 1:40 PM, Marc Glisse <marc.gli...@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.
Hi, This causes lots of tests under libstdc++-v3/testsuite/ext/ failed on aarch64-none-elf and arm-none-eabi with below log message. In file included from /home/binche01/work/oban-work/build-aarch64-none-elf/obj/gcc2/aarch64-none-elf/libstdc++-v3/include/ext/random:3494:0, from /home/binche01/work/oban-work/src/gcc/libstdc++-v3/testsuite/ext/random/arcsine_distribution/cons/default.cc:23: /home/binche01/work/oban-work/src/gcc/libstdc++-v3/include/ext/random.tcc: In member function '__gnu_cxx::{anonymous}::uniform_on_sphere_helper<2ul, _RealType>::result_type __gnu_cxx::{anonymous}::uniform_on_sphere_helper<2ul, _RealType>::operator()(_NormalDistribution&, _UniformRandomNumberGenerator&)': /home/binche01/work/oban-work/src/gcc/libstdc++-v3/include/ext/random.tcc:1609:18: error: 'hypot' is not a member of 'std' auto __norm = std::hypot(__ret[0], __ret[1]); ^ /home/binche01/work/oban-work/src/gcc/libstdc++-v3/include/ext/random.tcc:1609:18: note: suggested alternative: In file included from /home/binche01/work/oban-work/build-aarch64-none-elf/obj/gcc2/aarch64-none-elf/libstdc++-v3/include/cmath:44:0, from /home/binche01/work/oban-work/build-aarch64-none-elf/obj/gcc2/aarch64-none-elf/libstdc++-v3/include/random:38, from /home/binche01/work/oban-work/build-aarch64-none-elf/obj/gcc2/aarch64-none-elf/libstdc++-v3/include/ext/random:38, from /home/binche01/work/oban-work/src/gcc/libstdc++-v3/testsuite/ext/random/arcsine_distribution/cons/default.cc:23: /home/binche01/work/oban-work/target-aarch64-none-elf/aarch64-none-elf/include/math.h:306:15: note: 'hypot' extern double hypot _PARAMS((double, double)); ^ FAIL: ext/random/arcsine_distribution/cons/default.cc (test for excess errors) Excess errors: /home/binche01/work/oban-work/src/gcc/libstdc++-v3/include/ext/random.tcc:1609:18: error: 'hypot' is not a member of 'std' Thanks, bin