* do not blindly insert decimal seperators in StrToFloat, resolves #27029

git-svn-id: trunk@29126 -
This commit is contained in:
florian 2014-11-23 20:18:19 +00:00
parent a237648545
commit 9a31cba3d3
3 changed files with 22 additions and 4 deletions

1
.gitattributes vendored
View File

@ -14119,6 +14119,7 @@ tests/webtbs/tw26976.pp svneol=native#text/plain
tests/webtbs/tw26993.pp svneol=native#text/plain
tests/webtbs/tw26993a.pp svneol=native#text/plain
tests/webtbs/tw2702.pp svneol=native#text/plain
tests/webtbs/tw27029.pp svneol=native#text/pascal
tests/webtbs/tw2703.pp svneol=native#text/plain
tests/webtbs/tw2704.pp svneol=native#text/plain
tests/webtbs/tw2705.pp svneol=native#text/plain

View File

@ -1327,10 +1327,16 @@ Begin
{ Delete leading spaces }
while Result[1] = ' ' do
System.Delete(Result, 1, 1);
if Result[1] = '-' then
Result[3] := DS
else
Result[2] := DS;
{ not Nan etc.? }
if Pos('.', Result)<>0 then
begin
if Result[1] = '-' then
Result[3] := DS
else
Result[2] := DS;
end;
P:=Pos('E',Result);
if P <> 0 then
begin

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

@ -0,0 +1,11 @@
uses
sysutils, math;
begin
DecimalSeparator:=',';
if FloatToStrF(nan, ffExponent, 15, 1)<>'Nan' then
halt(1);
if FloatToStrF(1.3, ffExponent, 15, 1)[2]<>',' then
halt(1);
writeln('ok');
end.