<p dir="auto">The Codecov number on <a href="https://github.com/scipy/scipy">https://github.com/scipy/scipy</a> is 76%. There are a number of issues with this:</p>
<ul dir="auto">
<li><code class="notranslate">setup.py</code> files are measured, they should be excluded</li>
<li><code class="notranslate">test_*</code> files should probably be excluded</li>
<li>There may be other random files that should be excluded, e.g. <code class="notranslate">scipy/special/_precompute/*</code>.</li>
<li>The number is low because of parts of vendored C and Fortran libraries that we simply don't use but did not remove. Not sure what the best solution is there, perhaps more trouble than it's worth. Would be good to have a Python-only coverage number though, to see where there are actual gaps.</li>
</ul>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/1262" rel="nofollow">http://projects.scipy.org/scipy/ticket/1262</a> on 2010-08-13 by trac user pozharski, assigned to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pv/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pv">@pv</a>.</em></p>
<p dir="auto">The problem is clear from the summary.  I get</p>
<p dir="auto">scipy.stats.maxwell.ppf(0.2499999999999999) = 1.1011507176793141</p>
<p dir="auto">scipy.stats.maxwell.ppf(0.25) = 0.0</p>
<p dir="auto">scipy.stats.maxwell.ppf(0.2500000000000001) = 1.1011507176793145</p>
<p dir="auto">I looked in the distributions.py and scipy.stats.maxwell.ppf is calculated used scipy.special.gammaincinv, which shows the same behavior of returning zero when the argument is exactly 0.25.</p>
<p dir="auto">I found this bug report</p>
<p dir="auto">[http://projects.scipy.org/scipy/ticket/299]</p>
<p dir="auto">which says</p>
<p dir="auto">''This should be fixed in <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/scipy/scipy/commit/a32d4345a330788e9d09c0935f07df332658c613/hovercard" href="https://github.com/scipy/scipy/commit/a32d4345a330788e9d09c0935f07df332658c613"><tt>a32d434</tt></a>. I use false position to find the root of gammainc(a,x)-y=0 for y &lt; 0.25.<br>
''</p>
<p dir="auto">This led me to scipy/special/c_misc/gammaincinv.c which produces the artifact.  With y=0.25 you get fhi=0.0 which results in false_position returning FSOLVE_NOT_BRACKET and the return value of gammaincinv being set to 0.0.</p>
<p dir="auto">I guess the remedy would be to change line 28 to this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    if (a &lt;= 0.0 || y &lt;= 0.0 || y &gt;= 0.25) {"><pre class="notranslate"><code class="notranslate">    if (a &lt;= 0.0 || y &lt;= 0.0 || y &gt;= 0.25) {
</code></pre></div>
<p dir="auto">It is also possible that false_position harbors a bug in line 63.  If f1*f2==0, shouldn't it return the solution (either left or right side of the interval depending on which of f1 and f2 is zero).  It seems that gammaincinv/maxwell bug wouldn't exist if false_position were to exhibit such (presumably correct) behavior.</p>