Browse Source

# revisions: 32765,32766

git-svn-id: branches/fixes_3_0@33756 -
marco 9 years ago
parent
commit
ca447cc16e
2 changed files with 17 additions and 1 deletions
  1. 1 1
      rtl/objpas/classes/stringl.inc
  2. 16 0
      rtl/objpas/math.pp

+ 1 - 1
rtl/objpas/classes/stringl.inc

@@ -600,7 +600,7 @@ Var
 begin
   S:='';
   Result:=False;
-  If ((Length(Value)-P)<=0) then
+  If ((Length(Value)-P)<0) then
     exit;
   PS:=@Value[P];
   PC:=PS;

+ 16 - 0
rtl/objpas/math.pp

@@ -374,8 +374,10 @@ operator ** (bas,expo : int64) i: int64; inline;
 
 { rounds x towards positive infinity }
 function ceil(x : float) : Integer;
+function ceil64(x: float): Int64;
 { rounds x towards negative infinity }
 function floor(x : float) : Integer;
+function floor64(x: float): Int64;
 
 { misc. functions }
 
@@ -1055,6 +1057,13 @@ function ceil(x : float) : integer;
       Ceil:=Ceil+1;
   end;
 
+function ceil64(x: float): Int64;
+  begin
+    Ceil64:=Trunc(x);
+    if Frac(x)>0 then
+      Ceil64:=Ceil64+1;
+  end;
+
 function floor(x : float) : integer;
   begin
      Floor:=Trunc(x);
@@ -1062,6 +1071,13 @@ function floor(x : float) : integer;
        Floor := Floor-1;
   end;
 
+function floor64(x: float): Int64;
+  begin
+    Floor64:=Trunc(x);
+    if Frac(x)<0 then
+      Floor64:=Floor64-1;
+  end;
+
 
 procedure Frexp(X: float; var Mantissa: float; var Exponent: integer);
 begin