Browse Source

Fix RoundTo bug in FPC caused by invalid arithmetic type

Solution is to previously calculate as a Double and then assign to a Currency as expected
PascalCoin 5 years ago
parent
commit
eefcab9cbc
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/core/UAccounts.pas

+ 4 - 1
src/core/UAccounts.pas

@@ -1547,8 +1547,11 @@ begin
 end;
 end;
 
 
 class function TAccountComp.FormatMoneyDecimal(Money : Int64) : Currency;
 class function TAccountComp.FormatMoneyDecimal(Money : Int64) : Currency;
+var Ltmp : Double;
 begin
 begin
-  Result := RoundTo( Money / 10000.0, -4);
+  Ltmp := Money;
+  Ltmp := Ltmp / 10000.0;
+  Result := RoundTo( Ltmp , -4);
 end;
 end;
 
 
 class function TAccountComp.GetECInfoTxt(const EC_OpenSSL_NID: Word): String;
 class function TAccountComp.GetECInfoTxt(const EC_OpenSSL_NID: Word): String;