mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 18:29:09 +02:00
* Fixed carry bug in conversion of currency to string
git-svn-id: trunk@8612 -
This commit is contained in:
parent
5cb32f860b
commit
9777065197
@ -562,7 +562,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
Dec(reslen,r);
|
Dec(reslen,r);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ rounding string if r > 0 }
|
{ rounding string if r > 0 }
|
||||||
if r > 0 then
|
if r > 0 then
|
||||||
begin
|
begin
|
||||||
@ -570,17 +569,23 @@ begin
|
|||||||
k:=0;
|
k:=0;
|
||||||
for j:=0 to r do
|
for j:=0 to r do
|
||||||
begin
|
begin
|
||||||
buf[i]:=chr(ord(buf[i]) + k);
|
if (k=1) and (buf[i]='9') then
|
||||||
if buf[i] >= '5' then
|
buf[i]:='0'
|
||||||
k:=1
|
|
||||||
else
|
else
|
||||||
k:=0;
|
begin
|
||||||
|
buf[i]:=chr(ord(buf[i]) + k);
|
||||||
|
if buf[i] >= '5' then
|
||||||
|
k:=1
|
||||||
|
else
|
||||||
|
k:=0;
|
||||||
|
end;
|
||||||
Inc(i);
|
Inc(i);
|
||||||
if i>tlen then
|
if i>tlen then
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
|
If (k=1) and (buf[i-1]='0') then
|
||||||
|
buf[i]:=chr(Ord(buf[i])+1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ preparing result string }
|
{ preparing result string }
|
||||||
if reslen<len then
|
if reslen<len then
|
||||||
reslen:=len;
|
reslen:=len;
|
||||||
|
Loading…
Reference in New Issue
Block a user