Browse Source

* Fix formatfloat in case E not followed by +/- (bug id 35297)

git-svn-id: trunk@41803 -
michael 6 years ago
parent
commit
1951aff5a4
1 changed files with 12 additions and 9 deletions
  1. 12 9
      rtl/objpas/sysutils/fmtflt.inc

+ 12 - 9
rtl/objpas/sysutils/fmtflt.inc

@@ -369,18 +369,21 @@ begin
       'e', 'E':
       'e', 'E':
         begin
         begin
         ToResult(C); // Always needed
         ToResult(C); // Always needed
-        Inc(I);
-        if I<=Section.Length then
+        if IsScientific then
           begin
           begin
-          C:=Section[I];
-          if (C in ['+','-']) then
+          Inc(I);
+          if I<=Section.Length then
             begin
             begin
-            AddToResult(FormatExponent(C,FV.Exponent-DecimalPos+1));
-            // Skip rest
-            while (I<SectionLength) and (Section[i+1]='0') do
-              Inc(I);
+            C:=Section[I];
+            if (C in ['+','-']) then
+              begin
+              AddToResult(FormatExponent(C,FV.Exponent-DecimalPos+1));
+              // Skip rest
+              while (I<SectionLength) and (Section[i+1]='0') do
+                Inc(I);
+              end;
             end;
             end;
-          end;
+          end;  
         end;
         end;
       else
       else
         ToResult(C);
         ToResult(C);