in reply to Re^3: perl arithmetic is killing me! HELP!
in thread perl arithmetic is killing me! HELP!
I think there's at least one more condition, namely: Do not assign a value that's greater than UINT_MAX.
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.
but the result is one that I do not expect
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. The result should be the 32 lower-order bits of the sum.
Alas, such handling of this corner case
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: perl arithmetic is killing me! HELP!
by syphilis (Archbishop) on Nov 08, 2018 at 09:13 UTC | |
by ikegami (Patriarch) on Nov 09, 2018 at 13:28 UTC | |
by syphilis (Archbishop) on Nov 09, 2018 at 23:40 UTC |