mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 10:26:05 +02:00
* And once more fixed formatfloat. All results consistent with Delphi now
git-svn-id: trunk@12323 -
This commit is contained in:
parent
53a638ad9f
commit
6d93a762fd
@ -1999,8 +1999,10 @@ Var
|
|||||||
Width:=Placehold[1]+Placehold[2]+Decimals;
|
Width:=Placehold[1]+Placehold[2]+Decimals;
|
||||||
If (Decimals=0) Then
|
If (Decimals=0) Then
|
||||||
Str(Value:Width:0,Digits)
|
Str(Value:Width:0,Digits)
|
||||||
Else
|
Else if Value>=0 then
|
||||||
Str(Value:Width+1:Decimals,Digits);
|
Str(Value:Width+1:Decimals,Digits)
|
||||||
|
else
|
||||||
|
Str(Value:Width+2:Decimals,Digits);
|
||||||
len:=Length(Digits);
|
len:=Length(Digits);
|
||||||
{ Find the decimal point }
|
{ Find the decimal point }
|
||||||
If (Decimals=0) Then
|
If (Decimals=0) Then
|
||||||
@ -2028,25 +2030,19 @@ Var
|
|||||||
places, remove decimal point. }
|
places, remove decimal point. }
|
||||||
If (DecimalPoint < len) And (Digits[DecimalPoint + 1] = ' ') Then
|
If (DecimalPoint < len) And (Digits[DecimalPoint + 1] = ' ') Then
|
||||||
Digits[DecimalPoint] := ' ';
|
Digits[DecimalPoint] := ' ';
|
||||||
{ Convert spaces left from obligatory decimal point to zeroes. }
|
{ Convert spaces left from obligatory decimal point to zeroes.
|
||||||
|
MVC : If - sign is encountered, replace it too, and put at position 1}
|
||||||
I:=DecimalPoint-Placehold[2];
|
I:=DecimalPoint-Placehold[2];
|
||||||
While (I<DecimalPoint) And (Digits[I] in [' ']) Do
|
J:=0;
|
||||||
|
While (I<DecimalPoint) And (Digits[I] in [' ','-']) Do
|
||||||
Begin
|
Begin
|
||||||
|
If Digits[i]='-' then
|
||||||
|
J:=I;
|
||||||
Digits[I] := '0';
|
Digits[I] := '0';
|
||||||
Inc(I);
|
Inc(I);
|
||||||
End;
|
End;
|
||||||
{ Convert zeroes left from minus sign to spaces}
|
If (J<>0) then
|
||||||
// Search minus sign
|
Digits[1]:='-';
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user