note
haukex
<blockquote><i>In a sense am I being a little bit confused around what Devel:Peek is telling me</i></blockquote>
<p>If you want to dive into that rabbit hole, see [doc://perlguts] and the rest of the [https://perldoc.perl.org/index-internals.html|internals] documentation, although be warned, that's <i>not</i> light reading.</p>
<blockquote><i>These are actually <c>UV</c> values then? but Perl is storing them as <c>IV</c>'s.</i></blockquote>
<p>Those values will fit fine into a signed integer, so as per [dave_the_m]'s [id://11108823|explanation], Perl has no need to upgrade them to a UV. It might be interesting to note that Perl can store pretty big integer values. As per [ikegami]'s post [https://stackoverflow.com/a/15133735|here]:</p>
<blockquote>
<ol>
<li>Largest integer value that can be stored as a signed integer: <c>~0 >> 1</c> (on my machine: 9,223,372,036,854,775,807), and the smallest: <c>-(~0 >> 1)-1</c></li>
<li>Largest integer value that can be stored as an unsigned integer: <c>~0</c> (on my machine: 18,446,744,073,709,551,615)</li>
<li>All integer values from 0 to this number can be stored without loss as a floating point number: <c>$Config{nv_overflows_integers_at}</c> (on my machine: 9,007,199,254,740,992)</li>
</ol>
</blockquote>
<blockquote><i>two's complement</i></blockquote>
<p>One of the things that really helped it click for me back then was this graphic, along with looking at different 2's complement mathematical operations (<small><i>Update 2:</i></small> as I showed in [id://11108843|my reply below]):</p>
<c>
0
-1 0000 1
1111 0001
-2 2
1110 0010
-3 3
1101 0011
-4 4
1100 0100
-5 5
1011 0101
-6 6
1010 0110
-7 7
1001 -8 0111
1000
</c>
<p><small><i>Update:</i> In the graphic I accidentally wrote "8" when it should have been "-8", sorry, fixed.</small></p>
11108820
11108831