I have a function that has a var Extended
parameter. The compiler complains if I try to use a Double
type argument when I call the function. However, if I pass the Extended
value back as the function Result
(and assign to a Double
variable), then the compiler is happy.
Is this expected? If so, is there any way to fool the compiler to reduce the precision of the parameter to match the argument?
function foo1(var e: extended): boolean;
begin
e := 0.0;
Result := true;
end;
function foo2(): extended;
begin
Result := 0.0;
end;
procedure CallFoo();
var
d: double;
begin
if foo1(d) then Exit; // compiler complains
d := foo2; // compiler happy
end;