Skybuck Flying
2011-06-21 22:50:20 UTC
Hello,
The following code becomes negative in Delphi XE:
var
a : integer;
b : integer;
c : int64;
a := 65535;
b := 65535;
c := a * b; // negative :((((
Why does Delphi XE do such a stupid thing ?!?
The c is big enough to hold the result ?!
Yes I know Delphi XE is still 32 bit, but can't it simply do a 64 bit
calculation when it sees the left side is 64 bit ?!?
What would be a good solution for this apperently common problem ?
Bye,
Skybuck.
The following code becomes negative in Delphi XE:
var
a : integer;
b : integer;
c : int64;
a := 65535;
b := 65535;
c := a * b; // negative :((((
Why does Delphi XE do such a stupid thing ?!?
The c is big enough to hold the result ?!
Yes I know Delphi XE is still 32 bit, but can't it simply do a 64 bit
calculation when it sees the left side is 64 bit ?!?
What would be a good solution for this apperently common problem ?
Bye,
Skybuck.