<h3 dir="auto">Describe the issue:</h3>
<p dir="auto">Dividing (e.g.) (2**64-1) // 3 works as expected if 3 is an int, but produces a float result if 3 is a numpy.int64.<br>
Consequently, the corresponding modulus calculation produces an incorrect result (also float).</p>
<p dir="auto">This seems to occur just for dividends in the range of <code class="notranslate">2**63</code> to <code class="notranslate">2**64</code>.</p>
<p dir="auto">Division of int by numpy.int64 should return the correct integer result for the full range of dividend values.</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="import numpy

py3 = 3
npy3 = numpy.int64(3)
n1 = 2**64-1
n2 = 2**63+1
n3 = 2**64+2
n4 = 2**63-2
n5 = 2**128-1
n6 = 2**128+2
print(f&quot;n1 // py3 = {n1 // py3}, n1 % py3 = {n1 % py3}, n1 // npy3 = {n1 // npy3}, n1 % npy3 = {n1 % npy3}&quot;)
print(f&quot;n2 // py3 = {n2 // py3}, n2 % py3 = {n2 % py3}, n2 // npy3 = {n2 // npy3}, n2 % npy3 = {n2 % npy3}&quot;)
print(f&quot;n3 // py3 = {n3 // py3}, n3 % py3 = {n3 % py3}, n3 // npy3 = {n3 // npy3}, n3 % npy3 = {n3 % npy3}&quot;)
print(f&quot;n4 // py3 = {n4 // py3}, n4 % py3 = {n4 % py3}, n4 // npy3 = {n4 // npy3}, n4 % npy3 = {n4 % npy3}&quot;)
print(f&quot;n5 // py3 = {n5 // py3}, n5 % py3 = {n5 % py3}, n5 // npy3 = {n5 // npy3}, n5 % npy3 = {n5 % npy3}&quot;)
print(f&quot;n6 // py3 = {n6 // py3}, n6 % py3 = {n6 % py3}, n6 // npy3 = {n6 // npy3}, n6 % npy3 = {n6 % npy3}&quot;)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span>

<span class="pl-s1">py3</span> <span class="pl-c1">=</span> <span class="pl-c1">3</span>
<span class="pl-s1">npy3</span> <span class="pl-c1">=</span> <span class="pl-s1">numpy</span>.<span class="pl-en">int64</span>(<span class="pl-c1">3</span>)
<span class="pl-s1">n1</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-c1">**</span><span class="pl-c1">64</span><span class="pl-c1">-</span><span class="pl-c1">1</span>
<span class="pl-s1">n2</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-s1">n3</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-c1">**</span><span class="pl-c1">64</span><span class="pl-c1">+</span><span class="pl-c1">2</span>
<span class="pl-s1">n4</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">2</span>
<span class="pl-s1">n5</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-c1">**</span><span class="pl-c1">128</span><span class="pl-c1">-</span><span class="pl-c1">1</span>
<span class="pl-s1">n6</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-c1">**</span><span class="pl-c1">128</span><span class="pl-c1">+</span><span class="pl-c1">2</span>
<span class="pl-en">print</span>(<span class="pl-s">f"n1 // py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n1</span> <span class="pl-c1">//</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n1 % py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n1</span> <span class="pl-c1">%</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n1 // npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n1</span> <span class="pl-c1">//</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>, n1 % npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n1</span> <span class="pl-c1">%</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>"</span>)
<span class="pl-en">print</span>(<span class="pl-s">f"n2 // py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n2</span> <span class="pl-c1">//</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n2 % py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n2</span> <span class="pl-c1">%</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n2 // npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n2</span> <span class="pl-c1">//</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>, n2 % npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n2</span> <span class="pl-c1">%</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>"</span>)
<span class="pl-en">print</span>(<span class="pl-s">f"n3 // py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n3</span> <span class="pl-c1">//</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n3 % py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n3</span> <span class="pl-c1">%</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n3 // npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n3</span> <span class="pl-c1">//</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>, n3 % npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n3</span> <span class="pl-c1">%</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>"</span>)
<span class="pl-en">print</span>(<span class="pl-s">f"n4 // py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n4</span> <span class="pl-c1">//</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n4 % py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n4</span> <span class="pl-c1">%</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n4 // npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n4</span> <span class="pl-c1">//</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>, n4 % npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n4</span> <span class="pl-c1">%</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>"</span>)
<span class="pl-en">print</span>(<span class="pl-s">f"n5 // py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n5</span> <span class="pl-c1">//</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n5 % py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n5</span> <span class="pl-c1">%</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n5 // npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n5</span> <span class="pl-c1">//</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>, n5 % npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n5</span> <span class="pl-c1">%</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>"</span>)
<span class="pl-en">print</span>(<span class="pl-s">f"n6 // py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n6</span> <span class="pl-c1">//</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n6 % py3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n6</span> <span class="pl-c1">%</span> <span class="pl-s1">py3</span><span class="pl-kos">}</span></span>, n6 // npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n6</span> <span class="pl-c1">//</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>, n6 % npy3 = <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">n6</span> <span class="pl-c1">%</span> <span class="pl-s1">npy3</span><span class="pl-kos">}</span></span>"</span>)</pre></div>
<h3 dir="auto">Error message:</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">NumPy/Python version information:</h3>
<p dir="auto">1.23.4 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]</p>
<h3 dir="auto">Context for the issue:</h3>
<p dir="auto"><em>No response</em></p>
<p dir="auto">EDIT: since this issue has become somewhat of a stand-in for <code class="notranslate">uint64</code>-problems, here's a summary pulled up from the discussion further <a href="https://github.com/numpy/numpy/issues/12525#issuecomment-457727726" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/12525/hovercard">down</a>:</p>
<blockquote>
<p dir="auto">PS. Here's all the duckies in one neat row:</p>
<ul dir="auto">
<li>open related issues (all about <code class="notranslate">uint64</code> breaking due to casting to <code class="notranslate">float</code>, or closely related): <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="7731593" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/2524" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/2524/hovercard" href="https://github.com/numpy/numpy/issues/2524">#2524</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="7731606" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/2533" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/2533/hovercard" href="https://github.com/numpy/numpy/issues/2533">#2533</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="10533985" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/2955" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/2955/hovercard" href="https://github.com/numpy/numpy/issues/2955">#2955</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="24817442" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/4151" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/4151/hovercard" href="https://github.com/numpy/numpy/issues/4151">#4151</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="60725721" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/5668" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/5668/hovercard" href="https://github.com/numpy/numpy/issues/5668">#5668</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="66253604" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/5745" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/5745/hovercard" href="https://github.com/numpy/numpy/issues/5745">#5745</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="66254462" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/5746" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/5746/hovercard" href="https://github.com/numpy/numpy/issues/5746">#5746</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="142798709" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/7449" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/7449/hovercard" href="https://github.com/numpy/numpy/issues/7449">#7449</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="174521793" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/8002" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/8002/hovercard" href="https://github.com/numpy/numpy/issues/8002">#8002</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="216032133" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/8809" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/8809/hovercard" href="https://github.com/numpy/numpy/issues/8809">#8809</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="217214687" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/8851" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/8851/hovercard" href="https://github.com/numpy/numpy/issues/8851">#8851</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="271871843" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/9982" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/9982/hovercard" href="https://github.com/numpy/numpy/issues/9982">#9982</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="278686677" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/10148" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/10148/hovercard" href="https://github.com/numpy/numpy/issues/10148">#10148</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="297935662" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/10614" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/10614/hovercard" href="https://github.com/numpy/numpy/issues/10614">#10614</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="319016370" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/11020" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/11020/hovercard" href="https://github.com/numpy/numpy/issues/11020">#11020</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="353042448" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/11801" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/11801/hovercard" href="https://github.com/numpy/numpy/issues/11801">#11801</a></li>
<li>open related PRs: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="217268228" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/8853" data-hovercard-type="pull_request" data-hovercard-url="/numpy/numpy/pull/8853/hovercard" href="https://github.com/numpy/numpy/pull/8853">#8853</a></li>
<li>closed/duplicate issues (prob. very incomplete): <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="7731590" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/2523" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/2523/hovercard" href="https://github.com/numpy/numpy/issues/2523">#2523</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="129023522" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/7126" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/7126/hovercard" href="https://github.com/numpy/numpy/issues/7126">#7126</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="202698816" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/8522" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/8522/hovercard" href="https://github.com/numpy/numpy/issues/8522">#8522</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="224240337" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/8986" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/8986/hovercard" href="https://github.com/numpy/numpy/issues/8986">#8986</a></li>
<li>loosely related (prob. very incomplete): <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="9828218" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/2899" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/2899/hovercard" href="https://github.com/numpy/numpy/issues/2899">#2899</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="285870277" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/10322" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/10322/hovercard" href="https://github.com/numpy/numpy/issues/10322">#10322</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="318096864" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/10982" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/10982/hovercard" href="https://github.com/numpy/numpy/issues/10982">#10982</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="337875785" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/11485" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/11485/hovercard" href="https://github.com/numpy/numpy/issues/11485">#11485</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="395858378" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/12660" data-hovercard-type="pull_request" data-hovercard-url="/numpy/numpy/pull/12660/hovercard" href="https://github.com/numpy/numpy/pull/12660">#12660</a></li>
</ul>
</blockquote>
<hr>
<p dir="auto">There's a range of values of class <code class="notranslate">np.uint64</code> that fail a trivial comparison test: <code class="notranslate">v &gt; v - 1</code></p>
<p dir="auto">The issue is IMO that it effectively uses float-logic of some kind in the background, which is obviously neither desirable nor necessary.</p>
<h3 dir="auto">Reproducing code example:</h3>
<p dir="auto">The following comparisons should all return <code class="notranslate">True</code>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; for v in np.logspace(50, 63.9, num=20, base=2):
...     v = int(v)
...     c = np.array([v], dtype='uint64').max() &gt; v - 1
...     print(c, v)
...
True 1125899906842624
True 1869506547705232
True 3104232188555715
True 5154439010814696
True 8558715940823230
False 14211365854171536
False 23597338764077220
False 39182327895891032
False 65060506809279480
False 108030067981851424
False 179379106627232000
False 297851001073046464
False 494568294537084288
False 821208581069482368
False 1363580199279397888
False 2264164065900722176
False 3759543384412024832
False 6242554005755503616
True 10365482328612339712
True 17211420807207079936"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</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-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">for</span> <span class="pl-s1">v</span> <span class="pl-c1">in</span> <span class="pl-s1">np</span>.<span class="pl-en">logspace</span>(<span class="pl-c1">50</span>, <span class="pl-c1">63.9</span>, <span class="pl-s1">num</span><span class="pl-c1">=</span><span class="pl-c1">20</span>, <span class="pl-s1">base</span><span class="pl-c1">=</span><span class="pl-c1">2</span>):
...     <span class="pl-s1">v</span> <span class="pl-c1">=</span> <span class="pl-en">int</span>(<span class="pl-s1">v</span>)
...     <span class="pl-s1">c</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-s1">v</span>], <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s">'uint64'</span>).<span class="pl-en">max</span>() <span class="pl-c1">&gt;</span> <span class="pl-s1">v</span> <span class="pl-c1">-</span> <span class="pl-c1">1</span>
...     <span class="pl-s1">print</span>(<span class="pl-s1">c</span>, <span class="pl-s1">v</span>)
...
<span class="pl-c1">True</span> <span class="pl-c1">1125899906842624</span>
<span class="pl-c1">True</span> <span class="pl-c1">1869506547705232</span>
<span class="pl-c1">True</span> <span class="pl-c1">3104232188555715</span>
<span class="pl-c1">True</span> <span class="pl-c1">5154439010814696</span>
<span class="pl-c1">True</span> <span class="pl-c1">8558715940823230</span>
<span class="pl-c1">False</span> <span class="pl-c1">14211365854171536</span>
<span class="pl-c1">False</span> <span class="pl-c1">23597338764077220</span>
<span class="pl-c1">False</span> <span class="pl-c1">39182327895891032</span>
<span class="pl-c1">False</span> <span class="pl-c1">65060506809279480</span>
<span class="pl-c1">False</span> <span class="pl-c1">108030067981851424</span>
<span class="pl-c1">False</span> <span class="pl-c1">179379106627232000</span>
<span class="pl-c1">False</span> <span class="pl-c1">297851001073046464</span>
<span class="pl-c1">False</span> <span class="pl-c1">494568294537084288</span>
<span class="pl-c1">False</span> <span class="pl-c1">821208581069482368</span>
<span class="pl-c1">False</span> <span class="pl-c1">1363580199279397888</span>
<span class="pl-c1">False</span> <span class="pl-c1">2264164065900722176</span>
<span class="pl-c1">False</span> <span class="pl-c1">3759543384412024832</span>
<span class="pl-c1">False</span> <span class="pl-c1">6242554005755503616</span>
<span class="pl-c1">True</span> <span class="pl-c1">10365482328612339712</span>
<span class="pl-c1">True</span> <span class="pl-c1">17211420807207079936</span></pre></div>
<p dir="auto">The way I encountered this, is that <code class="notranslate">'uint64'</code> is the default dtype for values between <code class="notranslate">np.iinfo('int64').max + 1</code> and <code class="notranslate">np.iinfo('uint64').max</code> (which makes sense), but leads to the following problem:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; v = np.iinfo('int64').max
&gt;&gt;&gt; np.array([v + 1]) &gt; v
array([ True])
&gt;&gt;&gt; np.array([v + 1]).max() &gt; v
False
&gt;&gt;&gt; np.array([v + 1000]).max() == v
True"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">v</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">iinfo</span>(<span class="pl-s">'int64'</span>).<span class="pl-s1">max</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-s1">v</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span>]) <span class="pl-c1">&gt;</span> <span class="pl-s1">v</span>
<span class="pl-en">array</span>([ <span class="pl-c1">True</span>])
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-s1">v</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span>]).<span class="pl-en">max</span>() <span class="pl-c1">&gt;</span> <span class="pl-s1">v</span>
<span class="pl-c1">False</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-s1">v</span> <span class="pl-c1">+</span> <span class="pl-c1">1000</span>]).<span class="pl-en">max</span>() <span class="pl-c1">==</span> <span class="pl-s1">v</span>
<span class="pl-c1">True</span></pre></div>
<h3 dir="auto">Numpy/Python version information:</h3>

<p dir="auto">Numpy version: <code class="notranslate">1.15.4</code><br>
Python version: <code class="notranslate">3.6.6 (conda-forge)</code></p>