gcc/libstdc++-v3/testsuite/26_numerics/random
Jonathan Wakely 60d9f25487 libstdc++: Prefer double to long double in std::shuffle_order_engine
The transition algorithm for std::shuffle_order_engine uses long double
to ensure that the value (max() - min() + 1) can be accurately
represented, to avoid bias in the shuffling. However, when the base
engine's range is small enough we can avoid slower long double
arithmetic by using double. For example, long double is unnecessary for
any base engine returning 32-bit values.

This makes std::knuth_b::operator() about 15% faster on x86_64, and
probably even more on targets where long double uses soft-float.

libstdc++-v3/ChangeLog:

	* include/bits/random.h (independent_bit_engine): Fix typo
	in comment.
	(shuffle_order_engine): Fix incorrect description in comment.
	* include/bits/random.tcc (__representable_as_double
	(__p1_representable_as_double): New helper functions.
	(shuffle_order_engine::operator()): Use double for calculation
	if (max() - min() + 1) is representable as double.
	* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
	line number.
2020-10-31 12:54:03 +00:00
..
bernoulli_distribution
binomial_distribution
cauchy_distribution
chi_squared_distribution
discard_block_engine
discrete_distribution
exponential_distribution
extreme_value_distribution
fisher_f_distribution
gamma_distribution
geometric_distribution
independent_bits_engine
linear_congruential_engine
lognormal_distribution
mersenne_twister_engine
negative_binomial_distribution
normal_distribution
piecewise_constant_distribution
piecewise_linear_distribution
poisson_distribution
random_device
seed_seq libstdc++: Fix incorrect results in std::seed_seq::generate [PR 97311] 2020-10-09 16:58:32 +01:00
shuffle_order_engine
student_t_distribution
subtract_with_carry_engine
uniform_int_distribution
uniform_real_distribution
weibull_distribution
concept.cc
default_random_engine.cc
knuth_b.cc
minstd_rand0.cc
minstd_rand.cc
mt19937_64.cc
mt19937.cc
pr60037-neg.cc libstdc++: Prefer double to long double in std::shuffle_order_engine 2020-10-31 12:54:03 +00:00
ranlux24_base.cc
ranlux24.cc
ranlux48_base.cc
ranlux48.cc