This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR libstdc++/80137 use std::nextafter instead of looping


For gcc-6 I fixed a bug in generate_canonical that allowed it to
return a value outside the permitted range (due to rounding), but that
was done by looping until we got a value that was in range, which
violates the complexity requirements.

John Salmon suggested a better fix in bugzilla, which is what is used
here.

	PR libstdc++/80137
	* include/bits/random.tcc (generate_canonical): Use std::nextafter
	or numeric_limits::epsilon() to reduce out-of-range values.
	* testsuite/26_numerics/random/uniform_real_distribution/operators/
	64351.cc: Verify complexity requirement is met.

Tested powerpc64le-linux, committed to trunk.

This needs to be backported to gcc-6-branch too.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]