Browse Source

* patch by Rika: Implement TCurrencyHelper.Ceil/Floor, resolves #40134

florian 2 years ago
parent
commit
66891b1d59
1 changed files with 6 additions and 2 deletions
  1. 6 2
      rtl/objpas/sysutils/syshelp.inc

+ 6 - 2
rtl/objpas/sysutils/syshelp.inc

@@ -1591,12 +1591,16 @@ end;
 
 function TCurrencyHelper.Ceil: Int64;
 begin
-  {$warning TCurrencyHelper.Ceil unimplemented!}
+  Result:=System.Trunc(Self);
+  if Currency(Result)<Self then
+    Result:=Result+1;
 end;
 
 function TCurrencyHelper.Floor: Int64;
 begin
-  {$warning TCurrencyHelper.Floor unimplemented!}
+  Result:=System.Trunc(Self);
+  if Currency(Result)>Self then
+    Result:=Result-1;
 end;
 
 function TCurrencyHelper.Frac: Currency;