我正在处理一些古老的Delphi代码,但遇到了一些不太理解的地方。
[bla is set to 130245932]
outresult := ((bla * 1103516849) + 12359);
[outresult is equal to -413953101]
两个正数相乘怎么会得到一个负数?为什么当我把变量 bla 从方程中取出,直接使用整数时(像这样),结果也是一样的呢?
outresult := ((130245932 * 1103516849) + 12359);
我的应用程序甚至还没有编译就出现了错误。
[DCC Error] Unit1.pas(60): E2099 Overflow in conversion or arithmetic operation
Some genius would be appreciated. Thanks.