+ added (not yet fixed)

git-svn-id: trunk@2381 -
This commit is contained in:
Jonas Maebe 2006-01-29 22:46:46 +00:00
parent e58e92c4fa
commit 440637d72d
2 changed files with 52 additions and 0 deletions

1
.gitattributes vendored
View File

@ -5680,6 +5680,7 @@ tests/test/tstring7.pp svneol=native#text/plain
tests/test/tstring8.pp svneol=native#text/plain
tests/test/tstrreal1.pp svneol=native#text/plain
tests/test/tstrreal2.pp svneol=native#text/plain
tests/test/tstrreal3.pp -text
tests/test/tsubdecl.pp svneol=native#text/plain
tests/test/tunit1.pp svneol=native#text/plain
tests/test/tunit2.pp svneol=native#text/plain

51
tests/test/tstrreal3.pp Normal file
View File

@ -0,0 +1,51 @@
{ test by Graeme Geldenhuys }
{$mode delphi}
uses sysutils;
procedure test;
var
Result: string;
e: extended;
r: double;
begin
e := 234.502;
Result := FloatToStrF(e, ffGeneral, 15, 0);
// Memo1.Lines.Add(Result); { prints 234.502 }
writeln(result);
if (result <> '234.502') then
halt(1);
r := 234.502;
Result := FloatToStrF(r, ffGeneral, 15, 0);
// Memo1.Lines.Add(Result); { prints 234.50200000000001 }
writeln(result);
if (result <> '234.502') then
halt(1);
r := 234.501;
Result := FloatToStrF(r, ffGeneral, 15, 0);
// Memo1.Lines.Add(Result); { prints 234.501 Why does this work? }
writeln(result);
if (result <> '234.501') then
halt(1);
r := 7.502;
Result := FloatToStrF(r, ffGeneral, 15, 0);
// Memo1.Lines.Add(Result); { prints 7.502 }
writeln(result);
if (result <> '7.502') then
halt(1);
r := 8.502;
Result := FloatToStrF(r, ffGeneral, 15, 0);
// Memo1.Lines.Add(Result); { prints 8.502000000000001 }
writeln(result);
if (result <> '8.502') then
halt(1);
end;
begin
test;
end.