mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 04:09:30 +02:00
* do not blindly insert decimal seperators in StrToFloat, resolves #27029
git-svn-id: trunk@29126 -
This commit is contained in:
parent
a237648545
commit
9a31cba3d3
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
11
tests/webtbs/tw27029.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user