Browse Source

* Hopefully fixed formatfloat negative value bugs once and for all

git-svn-id: trunk@12303 -
michael 16 years ago
parent
commit
87a6193f4f
1 changed files with 13 additions and 8 deletions
  1. 13 8
      rtl/objpas/sysutils/sysstr.inc

+ 13 - 8
rtl/objpas/sysutils/sysstr.inc

@@ -2016,7 +2016,6 @@ Var
         Else
         Else
           Digits[DecimalPoint-1]:=' ';
           Digits[DecimalPoint-1]:=' ';
         End;
         End;
-
       { Convert optional zeroes to spaces. }
       { Convert optional zeroes to spaces. }
       I:=len;
       I:=len;
       J:=DecimalPoint+Placehold[3];
       J:=DecimalPoint+Placehold[3];
@@ -2031,17 +2030,23 @@ Var
           Digits[DecimalPoint] := ' ';
           Digits[DecimalPoint] := ' ';
       { Convert spaces left from obligatory decimal point to zeroes. }
       { Convert spaces left from obligatory decimal point to zeroes. }
       I:=DecimalPoint-Placehold[2];
       I:=DecimalPoint-Placehold[2];
-      If (Value<0) and (I<DecimalPoint) and (Digits[1]<>'-') then
-        begin
-        Insert('-',Digits,I);
-        Inc(DecimalPoint);
-        Inc(I);
-        end;
-      While (I<DecimalPoint) And (Digits[I] in [' ','-']) Do
+      While (I<DecimalPoint) And (Digits[I] in [' ']) Do
         Begin
         Begin
         Digits[I] := '0';
         Digits[I] := '0';
         Inc(I);
         Inc(I);
         End;
         End;
+      { Convert zeroes left from minus sign to spaces}  
+      // Search minus sign
+      I:=DecimalPoint;
+      While (I>0) and (Digits[i]<>'-') do
+        Dec(i);
+      // Now convert  
+      Dec(I);
+      While (I>0) and (Digits[i]='0') do
+        begin
+        Digits[I] := ' ';
+        Inc(I);
+        end;
       Exp := 0;
       Exp := 0;
       End
       End
     Else
     Else