<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:ldionne@apple.com" title="Louis Dionne <ldionne@apple.com>"> <span class="fn">Louis Dionne</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - std::binomial_distribution<int> hangs"
href="https://bugs.llvm.org/show_bug.cgi?id=44847">bug 44847</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>FIXED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>ldionne@apple.com
</td>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - std::binomial_distribution<int> hangs"
href="https://bugs.llvm.org/show_bug.cgi?id=44847#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - std::binomial_distribution<int> hangs"
href="https://bugs.llvm.org/show_bug.cgi?id=44847">bug 44847</a>
from <span class="vcard"><a class="email" href="mailto:ldionne@apple.com" title="Louis Dionne <ldionne@apple.com>"> <span class="fn">Louis Dionne</span></a>
</span></b>
<pre>Thanks for the report. Should be fixed by:
commit 51b78a3e06d4ef7da8404a1c51c3ede894a42cb6
Author: Atmn Patel <<a href="mailto:a335pate@uwaterloo.ca">a335pate@uwaterloo.ca</a>>
Date: Tue Mar 17 15:52:36 2020 -0400
[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 <a href="https://llvm.org/PR44847">https://llvm.org/PR44847</a>
Differential Revision: <a href="https://reviews.llvm.org/D74997">https://reviews.llvm.org/D74997</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>