<p dir="auto">If a python list argument to <code class="notranslate">np.array</code> contains a mixture of <code class="notranslate">int</code> and <code class="notranslate">np.uint64</code>, the array will have <code class="notranslate">dtype=np.float64</code>.<br>
Which results in a loss of information, since values are not exactly representable by float64.</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 numpy as np

def print_array(a):
    print(a.dtype, a)


large = 2**63 - 1

print_array(np.array([-1, large]))
print_array(np.array([-1, np.int64(large)]))
print_array(np.array([-1, np.uint64(large)]))
"><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-k">def</span> <span class="pl-en">print_array</span>(<span class="pl-s1">a</span>):
    <span class="pl-en">print</span>(<span class="pl-s1">a</span>.<span class="pl-s1">dtype</span>, <span class="pl-s1">a</span>)


<span class="pl-s1">large</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-c1">**</span><span class="pl-c1">63</span> <span class="pl-c1">-</span> <span class="pl-c1">1</span>

<span class="pl-en">print_array</span>(<span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-c1">-</span><span class="pl-c1">1</span>, <span class="pl-s1">large</span>]))
<span class="pl-en">print_array</span>(<span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-c1">-</span><span class="pl-c1">1</span>, <span class="pl-s1">np</span>.<span class="pl-en">int64</span>(<span class="pl-s1">large</span>)]))
<span class="pl-en">print_array</span>(<span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-c1">-</span><span class="pl-c1">1</span>, <span class="pl-s1">np</span>.<span class="pl-en">uint64</span>(<span class="pl-s1">large</span>)]))</pre></div>
<p dir="auto">Results in:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="int64 [                 -1 9223372036854775807]
int64 [                 -1 9223372036854775807]
float64 [-1.00000000e+00  9.22337204e+18]"><pre class="notranslate"><code class="notranslate">int64 [                 -1 9223372036854775807]
int64 [                 -1 9223372036854775807]
float64 [-1.00000000e+00  9.22337204e+18]
</code></pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="1.20.1 3.9.2 (default, Feb 20 2021, 18:40:11) 
[GCC 10.2.0]"><pre class="notranslate"><code class="notranslate">1.20.1 3.9.2 (default, Feb 20 2021, 18:40:11) 
[GCC 10.2.0]
</code></pre></div>
<p dir="auto">I expected to get uint64</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="umax = np.iinfo(np.uint64).max

np.array([umax]).dtype   # &lt;-- uint64, as expected

np.array([0, umax]).dtype  # &lt;-- float64, surprising"><pre class="notranslate"><code class="notranslate">umax = np.iinfo(np.uint64).max

np.array([umax]).dtype   # &lt;-- uint64, as expected

np.array([0, umax]).dtype  # &lt;-- float64, surprising
</code></pre></div>
<p dir="auto">There seems to be something special going on inference-wise around the int64 bound:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="imax = np.iinfo(np.int64).max

np.array([imax, umax]).dtype  # &lt;-- float64

np.array([imax+1, umax]).dtype  # &lt;-- uint64"><pre class="notranslate"><code class="notranslate">imax = np.iinfo(np.int64).max

np.array([imax, umax]).dtype  # &lt;-- float64

np.array([imax+1, umax]).dtype  # &lt;-- uint64
</code></pre></div>