All,
We have a program that is doing a range of calculations that result in large integers. In some cases we are seeing overflow when negative numbers are being converted to their 2 complement e.g. when assigning it to a value in an array.
This is effectively what is happening (not the actual code and that's deep inside a complex routine).
A = -1528596274
B<C,D> += A
B<C,D> shows as 2766371022
If we take the assignment out of that program and put just the code into a standalone routine with the same numbers it works without modifying the number. Other calculations using that number also work.
If we pass the value and array into a noddy three line subroutine to do the assignment, the value changes.
Any attempt to manipulate the number e.g. ABS or even testing it (if A < 0) also coerces it to the 2s complement.
If we turn it into a string, the same.
E = A : ''
E is 2766...
If we use string maths, the same.
Other routines in the system are handling much larger numbers without a problem.
Any ideas?
------------------------------
Brian Leach
Director
Brian Leach Consulting
Chipping Norton GB
------------------------------
