mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 22:48:57 +02:00
+ added (not yet fixed)
git-svn-id: trunk@2381 -
This commit is contained in:
parent
e58e92c4fa
commit
440637d72d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
51
tests/test/tstrreal3.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user