The Delphi Bug List

Entry No.
657
Compiler - Can't compile
The Delphi compiler returns 'Incompatible types' if you pass an Int64 to a built-in function (from the System unit) requiring a floating-point parameter.
1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02 4.03 5.0 5.01 6.0 6.01 6.02 Kylix 1.0
N/AN/AN/AN/AN/AUnknownUnknownUnknownExistsExistsExistsExistsExistsExistsExists
Description
Reported by M.H. Avegaart; checked by Jordan Russell
The Delphi compiler returns 'Incompatible types' if you pass an Int64 to a built-in function (from the System unit) requiring a floating-point parameter (e.g. Sin, Cos, ArcTan, Exp, Ln, Trunc, Frac, Int, Round). Other functions requiring a floating-point parameter (like from the Math unit) don't show this behavior.

Example:

var
  X: Int64;
  Y: Extended;
begin
  X := 1;
  Y := Ln(X);
end;

The compiler should do an internal conversion to Double or Extended like it does for all other integer types.

Solution / workaround
Force the conversion to a floating-point number by adding 0.0, e.g. Y := Ln(X + 0.0);
Latest update of this entry: 2002-03-18

Post a comment on this bug


Index page
Delphi Bug List home page
The Delphi Bug Lists are presently maintained by Jordan Russell, who has taken over this task from Reinier Sterkenburg since August 2000.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.