diff --git a/.gitattributes b/.gitattributes index 49fa6ad11e..59a0844036 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12427,6 +12427,7 @@ tests/webtbs/tw12993.pp svneol=native#text/plain tests/webtbs/tw13015.pp svneol=native#text/plain tests/webtbs/tw13019.pp svneol=native#text/plain tests/webtbs/tw13075.pp svneol=native#text/plain +tests/webtbs/tw13076.pp svneol=native#text/plain tests/webtbs/tw1310.pp svneol=native#text/plain tests/webtbs/tw13110.pp svneol=native#text/plain tests/webtbs/tw13133.pp svneol=native#text/plain diff --git a/rtl/objpas/sysutils/sysstr.inc b/rtl/objpas/sysutils/sysstr.inc index bc930c75e3..16336ac961 100644 --- a/rtl/objpas/sysutils/sysstr.inc +++ b/rtl/objpas/sysutils/sysstr.inc @@ -2277,7 +2277,7 @@ Var end; If thousand And (Digits[N]<>'-') Then Begin - If (DigitExponent Mod 3 = 0) And (DigitExponent>0) Then + If (DigitExponent Mod 3 = 0) And (DigitExponent>0) and (N > 1) Then Begin Buf[0] := FormatSettings.ThousandSeparator; Inc(Buf); diff --git a/tests/webtbs/tw13076.pp b/tests/webtbs/tw13076.pp new file mode 100644 index 0000000000..6ea5c8bbcd --- /dev/null +++ b/tests/webtbs/tw13076.pp @@ -0,0 +1,28 @@ +{$ifdef fpc} +{$mode objfpc} +{$endif} +program tw12385; + +uses + SysUtils; + +var + s: string; + cr: Extended; + +Procedure TestIt(CR : Extended; Fmt,Expected : String); + +begin + S:=FormatFloat(Fmt,cr); + If S<>Expected then + begin + Writeln('"',S,'"<>"',Expected,'" (latter is correct)'); + Halt(1); + end; +end; + +begin + DecimalSeparator:='.'; + ThousandSeparator:=','; + TestIt(-10,'###,###,##0.00','-10.00'); +end.