mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-03 23:50:36 +02:00
* removed extra space character when generating the maximal number of
significant digits and frac(value)+roundcorr overflows to 1 (mantis #15308, fix by Dariusz Mazur) git-svn-id: trunk@14563 -
This commit is contained in:
parent
d4e57bcfa9
commit
0c1247ba7d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10171,6 +10171,7 @@ tests/webtbs/tw15293.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15293a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15296.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15304.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15308.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1532.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15364.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15370.pp svneol=native#text/plain
|
||||
|
@ -379,15 +379,6 @@ begin
|
||||
begin
|
||||
roundStr(temp,spos);
|
||||
d := frac(d);
|
||||
if (f < 0) then
|
||||
begin
|
||||
dec(currprec);
|
||||
if (currprec=0) then
|
||||
begin
|
||||
inc(spos);
|
||||
temp[spos]:='0';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{ calculate the necessary fractional digits }
|
||||
for fracCount := 1 to currPrec do
|
||||
|
25
tests/webtbs/tw15308.pp
Normal file
25
tests/webtbs/tw15308.pp
Normal file
@ -0,0 +1,25 @@
|
||||
program testformatfloat;
|
||||
|
||||
uses SysUtils;
|
||||
|
||||
const
|
||||
val_format: string = '0.0000E+000';
|
||||
|
||||
var
|
||||
input: extended;
|
||||
|
||||
begin
|
||||
decimalseparator:='.';
|
||||
input:=1.05e2;
|
||||
if (formatfloat(val_format,input)<>'1.0500E+002') then
|
||||
begin
|
||||
writeln(formatfloat(val_format,input));
|
||||
halt(1);
|
||||
end;
|
||||
input:=1.06e2;
|
||||
if (formatfloat(val_format,input)<>'1.0600E+002') then
|
||||
begin
|
||||
writeln(formatfloat(val_format,input));
|
||||
halt(2);
|
||||
end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user