<p dir="auto">When adding int <code class="notranslate">1</code> to a numpy {u}int array, usually a type conversion to int64 happens. This is normal. If, however, the type is <code class="notranslate">uint64</code>, the array gets converted to <code class="notranslate">float64</code>. I had not expected that. Perhaps it's correct though. Opinions?</p>
<p dir="auto">MWE:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy

a = numpy.array(0, dtype=int)
print((a + 1).dtype)  # int64

a = numpy.array(0, dtype=numpy.uint16)
print((a + 1).dtype)  # int64

a = numpy.array(0, dtype=numpy.uint32)
print((a + 1).dtype)  # int64

a = numpy.array(0, dtype=numpy.uint64)
print((a + 1).dtype)  # float64!"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span>

<span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-s1">numpy</span>.<span class="pl-en">array</span>(<span class="pl-c1">0</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">int</span>)
<span class="pl-en">print</span>((<span class="pl-s1">a</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span>).<span class="pl-s1">dtype</span>)  <span class="pl-c"># int64</span>

<span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-s1">numpy</span>.<span class="pl-en">array</span>(<span class="pl-c1">0</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">numpy</span>.<span class="pl-s1">uint16</span>)
<span class="pl-en">print</span>((<span class="pl-s1">a</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span>).<span class="pl-s1">dtype</span>)  <span class="pl-c"># int64</span>

<span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-s1">numpy</span>.<span class="pl-en">array</span>(<span class="pl-c1">0</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">numpy</span>.<span class="pl-s1">uint32</span>)
<span class="pl-en">print</span>((<span class="pl-s1">a</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span>).<span class="pl-s1">dtype</span>)  <span class="pl-c"># int64</span>

<span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-s1">numpy</span>.<span class="pl-en">array</span>(<span class="pl-c1">0</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">numpy</span>.<span class="pl-s1">uint64</span>)
<span class="pl-en">print</span>((<span class="pl-s1">a</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span>).<span class="pl-s1">dtype</span>)  <span class="pl-c"># float64!</span></pre></div>
<p dir="auto">Hi,</p>
<p dir="auto">This is my first issue so I apologize if I have gotten something obviously wrong. Essentially, it appears that when using the polyfit function from numpy.polynomial.polynomial, the coefficients are returned with lowest order first; this is the opposite of what happens when the function numpy.polyfit is called. I believe that the documentation for both functions states that the highest order coefficient should be returned first. As an example, I've attached a screenshot of an IPython notebook with a minimal example along with the code. My version of numpy is 1.10.4 and I am on Debian 3.16.0-4.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from numpy.polynomial.polynomial import polyfit 
import numpy as np                            
print np.version.version
print np.polyfit([1,2],[2,4],1)
print polyfit([1,2],[2,4],1)"><pre class="notranslate"><code class="notranslate">from numpy.polynomial.polynomial import polyfit 
import numpy as np                            
print np.version.version
print np.polyfit([1,2],[2,4],1)
print polyfit([1,2],[2,4],1)
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/10506722/14084384/78697264-f4e8-11e5-8bdf-e2188637a7a6.png"><img src="https://cloud.githubusercontent.com/assets/10506722/14084384/78697264-f4e8-11e5-8bdf-e2188637a7a6.png" alt="numpy_polynomial_bug" style="max-width: 100%;"></a></p>