gcc/libstdc++-v3/testsuite/26_numerics
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
..
accumulate libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
adjacent_difference libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
bit libstdc++ P1956R1 On the names of low-level bit manipulation functions 2020-02-17 17:09:18 +00:00
complex Update copyright years. 2020-01-01 12:51:42 +01:00
endian Update copyright years. 2020-01-01 12:51:42 +01:00
exclusive_scan libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
gcd libstdc++: Minor header cleanup in <numeric> 2020-10-05 22:46:46 +01:00
headers libstdc++: Ensure c++NN effective target present in all C++17 tests 2020-07-31 19:58:02 +01:00
inclusive_scan libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
inner_product libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
iota libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
lcm libstdc++: Minor header cleanup in <numeric> 2020-10-05 22:46:46 +01:00
midpoint libstdc++: midpoint should not constrain T is complete (LWG 3200) 2020-02-19 15:28:45 +00:00
numbers libstdc++: Avoid using __float128 in strict modes 2020-07-31 19:58:03 +01:00
partial_sum libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
pstl/numeric_ops Synchronize libstdc++ PSTL with upstream LLVM PSTL 2019-06-07 22:01:16 +00:00
random libstdc++: Prefer double to long double in std::shuffle_order_engine 2020-10-31 12:54:03 +00:00
reduce libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
slice libstdc++: Add comparison operators to types from Numerics clause 2020-04-08 16:51:59 +01:00
slice_array Update copyright years. 2020-01-01 12:51:42 +01:00
transform_exclusive_scan libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
transform_inclusive_scan libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
transform_reduce libstdc++: P1645R1 constexpr for <numeric> algorithms 2020-02-26 10:23:17 -05:00
valarray libstdc++: Fix name clash with _Cosh in QNX headers [PR 95592] 2020-10-28 12:35:44 +00:00
lerp.cc Update copyright years. 2020-01-01 12:51:42 +01:00