llvm-project/libcxx
Atmn Patel 51b78a3e06 [libc++] Bugfix to std::binomial_distribution<int>
The current implementation of binomial_distribution is not guaranteed to
converge for certain extreme configurations of the engine and distribution.
This is due to a mistake in the implementation of the algorithm from the
given reference paper. The algorithm in the paper is guaranteed to
terminate but has redundant statements. The current implementation
simplified away the redundancy into a while loop, but it excludes the
return condition of the case where a good sample cannot be returned for
the particular sample being used from the uniform distribution, which is
what causes the infinite loop. This change guarantees termination by
recognizing that a good sample cannot be returned and returning 0 after
breaking the loop. This is also in contrast to the paper because the
return value as specified in the paper violates basic checks in at least
a subset of the extreme cases where the current implementation fails to
terminate. This default return value of 0 is satisfactory for the
extreme case known so far.

Since this is only meant to affect extreme cases where the algorithm
does not terminate anyways, the behavior is expected to remain exactly
the same for all non-extreme cases that have been terminating so far.

Fixes https://llvm.org/PR44847

Differential Revision: https://reviews.llvm.org/D74997
2020-03-17 15:56:16 -04:00
..
benchmarks Revert "[libcxx] Enable C++17 for the benchmarks." 2020-03-12 22:23:46 +01:00
cmake [libc++] [cmake] Better diagnostics for missing abi library headers 2020-03-11 21:02:45 +03:00
docs [libc++] [P0646] Add feature-test macro for __cpp_lib_list_remove_return_type. 2020-03-12 11:06:49 +01:00
fuzzing [libc++] Tolerate NaN returning random distributions for now 2019-12-12 17:11:13 -05:00
include [libc++] Bugfix to std::binomial_distribution<int> 2020-03-17 15:56:16 -04:00
lib [libc++] Add SHA for C++20 Synchronization Library in ABI changelog 2020-03-11 16:13:13 -04:00
src Add flag _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATIONS for basic_string ABI 2020-03-02 10:26:37 -05:00
test [libc++] Bugfix to std::binomial_distribution<int> 2020-03-17 15:56:16 -04:00
utils [libc++] Use env to set the tool's environment on Darwin 2020-03-17 15:40:51 -04:00
www [libc++] [P0646] Add feature-test macro for __cpp_lib_list_remove_return_type. 2020-03-12 11:06:49 +01:00
.clang-format
.gitignore
CMakeLists.txt [CMake][libcxx] Don't wrap __config_site path in quotes on Windows 2020-01-29 19:37:35 -08:00
CREDITS.TXT [libcxx] Add Sergej Jaskiewicz to CREDITS.txt 2019-11-21 12:06:10 +03:00
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
NOTES.TXT Reland "Use custom command and target to install libc++ headers" 2018-06-12 03:10:02 +00:00
TODO.TXT
appveyor-reqs-install.cmd Attempt to upgrade compiler used by appveyor builds 2019-04-03 20:40:01 +00:00
appveyor.yml disable appveyor config for MSVC 2015 2019-04-03 20:36:51 +00:00