* fixed mantis 8434 (wrong precision used in case of |number| < 1,

which when multiplied by 10^x goes from 0.9y to 1.0z, and if a
    specific presision is specified)

git-svn-id: trunk@6692 -
This commit is contained in:
Jonas Maebe 2007-03-01 14:30:55 +00:00
parent 025b57815f
commit e44a9ca4cb
3 changed files with 14 additions and 1 deletions

1
.gitattributes vendored
View File

@ -8052,6 +8052,7 @@ tests/webtbs/tw8312.pp svneol=native#text/plain
tests/webtbs/tw8321.pp svneol=native#text/plain tests/webtbs/tw8321.pp svneol=native#text/plain
tests/webtbs/tw8371.pp svneol=native#text/plain tests/webtbs/tw8371.pp svneol=native#text/plain
tests/webtbs/tw8391.pp svneol=native#text/plain tests/webtbs/tw8391.pp svneol=native#text/plain
tests/webtbs/tw8434.pp svneol=native#text/plain
tests/webtbs/ub1873.pp svneol=native#text/plain tests/webtbs/ub1873.pp svneol=native#text/plain
tests/webtbs/ub1883.pp svneol=native#text/plain tests/webtbs/ub1883.pp svneol=native#text/plain
tests/webtbs/uw0555.pp svneol=native#text/plain tests/webtbs/uw0555.pp svneol=native#text/plain

View File

@ -384,7 +384,8 @@ begin
begin begin
roundStr(temp,spos); roundStr(temp,spos);
d := frac(d); d := frac(d);
dec(currprec); if (f < 0) then
dec(currprec);
end; end;
{ calculate the necessary fractional digits } { calculate the necessary fractional digits }
for fracCount := 1 to currPrec do for fracCount := 1 to currPrec do

11
tests/webtbs/tw8434.pp Normal file
View File

@ -0,0 +1,11 @@
uses sysutils;
var
x: double;
begin
x := 0.099991;
if (Format('%5.2f', [x]) <> ' 0.10') then
halt(1);
if (Format('%6.3f', [x]) <> ' 0.100') then
halt(2);
end.