In reply to Jonathan_Alvarez:
That problem is due to the fact that the resulting value from
array.sum() has the same type as each element in the array. That means it does not handle overflow unless you change type of each element being summed. My example does not have that problem because I was constraining the value of each element to a relatively small value that would never overflow.
I was exposing a slightly different problem that you can have anytime you deal with signed values in arithmetic expressions. most people forget that negative numbers can form valid solutions. So you either need to keep everything unsigned, or place constraints to keep the values positive.