<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/2154" rel="nofollow">http://projects.scipy.org/numpy/ticket/2154</a> on 2012-06-08 by trac user ktdrv, assigned to unknown.</em></p>
<p dir="auto">Unless this is expected but undocumented behavior, trying to dot product an array in-place, results in a broken result:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; a = arange(1, 10, dtype = float64).reshape(3, 3)
&gt;&gt;&gt; a
array([[ 1.,  2.,  3.],
       [ 4.,  5.,  6.],
       [ 7.,  8.,  9.]])
&gt;&gt;&gt; dot(a, identity(3), a)
array([[ 0.,  2.,  3.],
       [ 4.,  5.,  6.],
       [ 7.,  8.,  9.]])"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; a = arange(1, 10, dtype = float64).reshape(3, 3)
&gt;&gt;&gt; a
array([[ 1.,  2.,  3.],
       [ 4.,  5.,  6.],
       [ 7.,  8.,  9.]])
&gt;&gt;&gt; dot(a, identity(3), a)
array([[ 0.,  2.,  3.],
       [ 4.,  5.,  6.],
       [ 7.,  8.,  9.]])
</code></pre></div>
<h3 dir="auto">Describe the issue:</h3>
<p dir="auto">when I use the np.digitize, if the input bin is generated using np.arrange, the binning results are wrong even I set right =True.</p>
<h3 dir="auto">Reproduce the code example:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="number = np.arange(-10,10.2,0.2)
number
a = [0.2,0.4,1.0]
bin_index = np.digitize(a, number,right=True)
number[bin_index]"><pre class="notranslate"><span class="pl-s1">number</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">-</span><span class="pl-c1">10</span>,<span class="pl-c1">10.2</span>,<span class="pl-c1">0.2</span>)
<span class="pl-s1">number</span>
<span class="pl-s1">a</span> <span class="pl-c1">=</span> [<span class="pl-c1">0.2</span>,<span class="pl-c1">0.4</span>,<span class="pl-c1">1.0</span>]
<span class="pl-s1">bin_index</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">digitize</span>(<span class="pl-s1">a</span>, <span class="pl-s1">number</span>,<span class="pl-s1">right</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-s1">number</span>[<span class="pl-s1">bin_index</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="The results should be [0.2, 0.4, 1.0] it turns out to be array([0.4, 0.6, 1.2])"><pre class="notranslate">The results should be [0.2, 0.4, 1.0] it turns out to be array([0.4, 0.6, 1.2])</pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<p dir="auto">1.21.5 3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:00:33)<br>
[Clang 13.0.1 ]</p>
<h3 dir="auto">Context for the issue:</h3>
<p dir="auto"><em>No response</em></p>