Just in case you were not writing out your thoughts so the reader can learn...

The limits are of a power of 2.. 'cause it's binary. For every extra bit you tack on, you are adding to a position representing 2^(N+1) position, after the most significant bit. Adding to a 1 bit number makes it 2 bits and a max of 3 (4-1). Adding another bit makes it a 3 bit number, and givig it a max of 7 (8-1), It's minus one just 'cause that's how binary works. 2^n would be 1000....

Same w/ char's (2^8 in ascii), unicode, (2^8 * 2 == 2^16)..

With signed numbers, it's a bit different.. since your most significant bit, teh bit with teh largest 2^n position would be, is just a bit saying if the number is negative or not. But for more reference on how that works, look up 2's compliment on google. :) I 'm going to bed.

Play that funky music white boy..

In reply to Re: Re: Re: How to portably determine integer limits? by exussum0
in thread How to portably determine integer limits? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.