<h3 dir="auto">Describe your issue.</h3>
<p dir="auto">This may be a duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1058958328" data-permission-text="Title is private" data-url="https://github.com/scipy/scipy/issues/15072" data-hovercard-type="issue" data-hovercard-url="/scipy/scipy/issues/15072/hovercard" href="https://github.com/scipy/scipy/issues/15072">gh-15072</a>, but 1) I don't have a big array (50 values), and 2) this method did not return any NaN's, just unexpected large (negative or positive) values.</p>
<p dir="auto">I finally caught the issue when I realized I had switched from scipy==1.4.1 to scipy==1.7.3 (before, it was working)</p>
<p dir="auto">I'm attaching two plots made with the same code example, but each with a different scipy version. In the 1.4.1 one, the decimate result is correct and independent of the type of array, and in the 1.7.3, it's wrong for the float32 array:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/33642154/148854466-45337928-ee14-4f75-a977-21e32278a9f5.png"><img src="https://user-images.githubusercontent.com/33642154/148854466-45337928-ee14-4f75-a977-21e32278a9f5.png" alt="scipy1" style="max-width: 100%;"></a><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/33642154/148854486-6cd0f9bf-de69-427a-ba98-add71b779041.png"><img src="https://user-images.githubusercontent.com/33642154/148854486-6cd0f9bf-de69-427a-ba98-add71b779041.png" alt="scipy2" style="max-width: 100%;"></a></p>
<h3 dir="auto">Reproducing Code Example</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import scipy.signal as ssi
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(1)
n = 50
p = np.random.rand(n)
q = 20
p_d1 = ssi.decimate(np.asarray(p, dtype='float32'), q)
p_d2 = ssi.decimate(np.asarray(p, dtype='float64'), q)
print('max p_d1 (float32): ', max(p_d1))  # scipy==1.4.1: 0.526 / scipy==1.7.3: 5279  &lt;- wrong
print('max p_d2 (float64): ', max(p_d2))  # scipy==1.4.1: 0.526 / scipy==1.7.3: 0.526

# Optionally plot
t = list(range(n))
t_d = [t[i * q] for i in range(len(p_d1))]
plt.plot(t, p, marker='o')
plt.plot(t_d, p_d1, marker='s')
plt.plot(t_d, p_d2, marker='x')
plt.legend(['float32', 'float32 &gt; decimated', 'float64 &gt; decimated'], loc='upper right')
plt.title('scipy==1.4.1')  # scipy==1.4.1 / scipy==1.7.3 (latest to date)
plt.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">scipy</span>.<span class="pl-s1">signal</span> <span class="pl-k">as</span> <span class="pl-s1">ssi</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">seed</span>(<span class="pl-c1">1</span>)
<span class="pl-s1">n</span> <span class="pl-c1">=</span> <span class="pl-c1">50</span>
<span class="pl-s1">p</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">rand</span>(<span class="pl-s1">n</span>)
<span class="pl-s1">q</span> <span class="pl-c1">=</span> <span class="pl-c1">20</span>
<span class="pl-s1">p_d1</span> <span class="pl-c1">=</span> <span class="pl-s1">ssi</span>.<span class="pl-en">decimate</span>(<span class="pl-s1">np</span>.<span class="pl-en">asarray</span>(<span class="pl-s1">p</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s">'float32'</span>), <span class="pl-s1">q</span>)
<span class="pl-s1">p_d2</span> <span class="pl-c1">=</span> <span class="pl-s1">ssi</span>.<span class="pl-en">decimate</span>(<span class="pl-s1">np</span>.<span class="pl-en">asarray</span>(<span class="pl-s1">p</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s">'float64'</span>), <span class="pl-s1">q</span>)
<span class="pl-en">print</span>(<span class="pl-s">'max p_d1 (float32): '</span>, <span class="pl-en">max</span>(<span class="pl-s1">p_d1</span>))  <span class="pl-c"># scipy==1.4.1: 0.526 / scipy==1.7.3: 5279  &lt;- wrong</span>
<span class="pl-en">print</span>(<span class="pl-s">'max p_d2 (float64): '</span>, <span class="pl-en">max</span>(<span class="pl-s1">p_d2</span>))  <span class="pl-c"># scipy==1.4.1: 0.526 / scipy==1.7.3: 0.526</span>

<span class="pl-c"># Optionally plot</span>
<span class="pl-s1">t</span> <span class="pl-c1">=</span> <span class="pl-en">list</span>(<span class="pl-en">range</span>(<span class="pl-s1">n</span>))
<span class="pl-s1">t_d</span> <span class="pl-c1">=</span> [<span class="pl-s1">t</span>[<span class="pl-s1">i</span> <span class="pl-c1">*</span> <span class="pl-s1">q</span>] <span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-en">len</span>(<span class="pl-s1">p_d1</span>))]
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">t</span>, <span class="pl-s1">p</span>, <span class="pl-s1">marker</span><span class="pl-c1">=</span><span class="pl-s">'o'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">t_d</span>, <span class="pl-s1">p_d1</span>, <span class="pl-s1">marker</span><span class="pl-c1">=</span><span class="pl-s">'s'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">t_d</span>, <span class="pl-s1">p_d2</span>, <span class="pl-s1">marker</span><span class="pl-c1">=</span><span class="pl-s">'x'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">legend</span>([<span class="pl-s">'float32'</span>, <span class="pl-s">'float32 &gt; decimated'</span>, <span class="pl-s">'float64 &gt; decimated'</span>], <span class="pl-s1">loc</span><span class="pl-c1">=</span><span class="pl-s">'upper right'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">title</span>(<span class="pl-s">'scipy==1.4.1'</span>)  <span class="pl-c"># scipy==1.4.1 / scipy==1.7.3 (latest to date)</span>
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<h3 dir="auto">Error message</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="None!!"><pre class="notranslate">None<span class="pl-k">!!</span></pre></div>
<h3 dir="auto">SciPy/NumPy/Python version information</h3>
<p dir="auto">No issue with scipy==1.4.1; Issue with scipy==1.7.3</p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/1269" rel="nofollow">http://projects.scipy.org/scipy/ticket/1269</a> on 2010-08-30 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/josef-pkt/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/josef-pkt">@josef-pkt</a>, assigned to unknown.</em></p>
<p dir="auto">I don't think including the old fuzz tests in test_distributions are necessary anymore.</p>
<p dir="auto">They could be replaced by the new tests, which use a seed, and reuse the random variables, which should speed up the tests a bit.</p>
<p dir="auto">For occasional use, a full fuzz-testing script could be added to the source tree, but with naming so it doesn't run automatically</p>