Einzelnen Beitrag anzeigen

Delphi.Narium

Registriert seit: 27. Nov 2017
2.545 Beiträge
 
Delphi 7 Professional
 
#13

AW: Rundungsproblem in Delphi

  Alt 29. Jan 2025, 10:27
@haentschman
Es geht nach wie vor um Delphi 7 und dort gibt es nur

function SimpleRoundTo(const AValue: Double; const ADigit: TRoundToRange = -2): Double;
Delphi-Quellcode:
function SimpleRoundTo(const AValue: Double; const ADigit: TRoundToRange = -2): Double;
var
  LFactor: Double;
begin
  LFactor := IntPower(10, ADigit);
  Result := Trunc((AValue / LFactor) + 0.5) * LFactor;
end;
  Mit Zitat antworten Zitat