aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test/lock.py
diff options
context:
space:
mode:
authorAtmn Patel <a335pate@uwaterloo.ca>2020-03-17 15:52:36 -0400
committerLouis Dionne <ldionne@apple.com>2020-03-17 15:56:16 -0400
commit51b78a3e06d4ef7da8404a1c51c3ede894a42cb6 (patch)
treeab6a0d081ef7af549932da914e4b8db1b9d8c96c /lldb/packages/Python/lldbsuite/test/lock.py
parent526c51e6fdc834b703e14ca851a8c95c7f1c9b2f (diff)
downloadllvm-51b78a3e06d4ef7da8404a1c51c3ede894a42cb6.zip
llvm-51b78a3e06d4ef7da8404a1c51c3ede894a42cb6.tar.gz
llvm-51b78a3e06d4ef7da8404a1c51c3ede894a42cb6.tar.bz2
[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
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lock.py')
0 files changed, 0 insertions, 0 deletions