Hello

Hello,

Below is reproduced on both Delphi 10.2.3 and Delphi 10.2.2.

I expect code to display 1715. I do read 1715 (no decimals) after multiplication on Debug. After Trunc() value is 1714.

I know Trunc() rounds towards zero. It is just there is nothing to round as decimal here.

var
ADouble: Double;
AInteger: Integer;
begin
ADouble := 17.15;
ADouble := ADouble * 100;
AInteger := Trunc(ADouble);
ShowMessage(AInteger.ToString());
end;

Thanks.

Comments

Post a Comment