No, that's not a precondition, because not assigning a value greater than (or equal to) "UINT_MAX" is exactly what the OP is trying to do.

Well ... it may be that the OP is already attempting to adhere to that precondition - I haven't studied the details.
But it's still a precondition, and one of which we would best be fully aware.

It is not only the result the OP wants, it's the result you should expect since Perl's integer addition is implemented as a C integer addition.

If you read carefully what I wrote you'll see that I have no issue with the implementation of the integer addition. I do, however, have disdain for the way that overflowed integer values are assigned under the integer pragma. (The reason that I don't like that behaviour is because it differs from C.)

integer clearly says it "only affects how most of the arithmetic and relational operators handle their operands and results, and not how all numbers everywhere are treated" and proceeds to list the specifics

Firstly, that's good to hear - and no less than what I would expect of perl documentation.
Secondly, let's recommend that the OP carefully reads that documentation. The first question asked was "Can somebody explain to me how to do 32-bit operations in Perl?".
So, if 'use integer' is the preferred option, then I think harangzsolt33 may well benefit from being fully aware of all caveats relating to this pragma.

Cheers,
Rob

In reply to Re^5: perl arithmetic is killing me! HELP! by syphilis
in thread perl arithmetic is killing me! HELP! by harangzsolt33

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.