<p dir="auto">I found that numpy.sqrt has a strange type mapping:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; numpy.sqrt.types
['f-&gt;f', 'd-&gt;d', 'e-&gt;e', 'f-&gt;f', 'd-&gt;d', 'g-&gt;g', 'F-&gt;F', 'D-&gt;D', 'G-&gt;G', 'O-&gt;O']"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; numpy.sqrt.types
['f-&gt;f', 'd-&gt;d', 'e-&gt;e', 'f-&gt;f', 'd-&gt;d', 'g-&gt;g', 'F-&gt;F', 'D-&gt;D', 'G-&gt;G', 'O-&gt;O']
</code></pre></div>
<p dir="auto">It causes sqrt to upcast float16 to float32. It is also strange that 'f' and 'd' appear twice. Is this definition/behavior intended?<br>
Note: I checked it with NumPy 1.9.2 on Python 2.7.9 &amp; 3.4.3.</p>
<p dir="auto">Sorry, if this is a duplicate but I could not find a matching issue..</p>
<p dir="auto">I am reporting an issue that was introduced <em>after</em> version 1.8.2 and is present in all of 1.9.1, 1.9.2rc1 and master (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/numpy/numpy/commit/a4cdc5b8d314fcf18faf29d82e84c877c4ed0e3f/hovercard" href="https://github.com/numpy/numpy/commit/a4cdc5b8d314fcf18faf29d82e84c877c4ed0e3f"><tt>a4cdc5b</tt></a>). I am on Python 2.7.9.</p>
<p dir="auto">Here's a snippet to illustrate the issue:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np

a = np.arange(10)
print a

mask = a &gt; 4
print mask

a[mask].fill(-1)
a[~mask].fill(-2)
print a

a[mask] = -1
a[~mask] = -2
print a"><pre class="notranslate"><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">a</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">10</span>)
<span class="pl-k">print</span> <span class="pl-s1">a</span>

<span class="pl-s1">mask</span> <span class="pl-c1">=</span> <span class="pl-s1">a</span> <span class="pl-c1">&gt;</span> <span class="pl-c1">4</span>
<span class="pl-k">print</span> <span class="pl-s1">mask</span>

<span class="pl-s1">a</span>[<span class="pl-s1">mask</span>].<span class="pl-en">fill</span>(<span class="pl-c1">-</span><span class="pl-c1">1</span>)
<span class="pl-s1">a</span>[<span class="pl-c1">~</span><span class="pl-s1">mask</span>].<span class="pl-en">fill</span>(<span class="pl-c1">-</span><span class="pl-c1">2</span>)
<span class="pl-k">print</span> <span class="pl-s1">a</span>

<span class="pl-s1">a</span>[<span class="pl-s1">mask</span>] <span class="pl-c1">=</span> <span class="pl-c1">-</span><span class="pl-c1">1</span>
<span class="pl-s1">a</span>[<span class="pl-c1">~</span><span class="pl-s1">mask</span>] <span class="pl-c1">=</span> <span class="pl-c1">-</span><span class="pl-c1">2</span>
<span class="pl-k">print</span> <span class="pl-s1">a</span></pre></div>
<p dir="auto">which produces..</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[0 1 2 3 4 5 6 7 8 9]
[False False False False False  True  True  True  True  True]
[0 1 2 3 4 5 6 7 8 9]
[-2 -2 -2 -2 -2 -1 -1 -1 -1 -1]"><pre class="notranslate"><code class="notranslate">[0 1 2 3 4 5 6 7 8 9]
[False False False False False  True  True  True  True  True]
[0 1 2 3 4 5 6 7 8 9]
[-2 -2 -2 -2 -2 -1 -1 -1 -1 -1]
</code></pre></div>
<p dir="auto">I've tried to <code class="notranslate">git bisect</code> to the responsible commit, but git seems to get confused, it stops the bisect run with the following message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="The merge base 6c729b4423857850e6553cf6c2d0fc8b026036dd is bad.
This means the bug has been fixed between 6c729b4423857850e6553cf6c2d0fc8b026036dd and [4563730a2d036307f1b67b2856d749aabdd8d546]."><pre class="notranslate"><code class="notranslate">The merge base 6c729b4423857850e6553cf6c2d0fc8b026036dd is bad.
This means the bug has been fixed between 6c729b4423857850e6553cf6c2d0fc8b026036dd and [4563730a2d036307f1b67b2856d749aabdd8d546].
</code></pre></div>
<p dir="auto">Here's the <code class="notranslate">git bisect log</code> afterwards:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="git bisect start
# good: [4563730a2d036307f1b67b2856d749aabdd8d546] REL: Release 1.8.2
git bisect good 4563730a2d036307f1b67b2856d749aabdd8d546
# bad: [d44b9c61499f8bc5a9fc94286cd52f05e15e003f] REL: Release 1.9.1
git bisect bad d44b9c61499f8bc5a9fc94286cd52f05e15e003f
# bad: [6c729b4423857850e6553cf6c2d0fc8b026036dd] Merge pull request #3635 from charris/giant-style-cleanup
git bisect bad 6c729b4423857850e6553cf6c2d0fc8b026036dd"><pre class="notranslate"><code class="notranslate">git bisect start
# good: [4563730a2d036307f1b67b2856d749aabdd8d546] REL: Release 1.8.2
git bisect good 4563730a2d036307f1b67b2856d749aabdd8d546
# bad: [d44b9c61499f8bc5a9fc94286cd52f05e15e003f] REL: Release 1.9.1
git bisect bad d44b9c61499f8bc5a9fc94286cd52f05e15e003f
# bad: [6c729b4423857850e6553cf6c2d0fc8b026036dd] Merge pull request #3635 from charris/giant-style-cleanup
git bisect bad 6c729b4423857850e6553cf6c2d0fc8b026036dd
</code></pre></div>