Lazarus 2.0.10, in Ubuntu: myResult = 3919350
That is the correct result when
Longint is 64bits in size.
Lazarus 2.0.10, in Windows: myResult = -3861387
That is the correct result when
Longint is 32bits in size.
The same code, but two different results.
Because you are operating on a data type that has different sizes on different platforms.
I think - problem is with integer division
Actually, the problem is with the integer multiplication.
When
Longint is 32bits, the result of
((a-b)*c) (
((828-653)*12362752) = 2163481600) overflows the max value of
Longint (
2147483647), so the result of the multiplication is a negative value (
-2131485696), then the result of the integer division is also negative (
-2131485696 / 552 = -3861387).
When
Longint is 64bits, there is no overflow.