Explorar o código

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

florian %!s(int64=2) %!d(string=hai) anos
pai
achega
88fc1dcdee
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  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;