mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 01:08:07 +02:00
* don't add a thousands separator in FormatFloat if there are no digits
before it because the value is too small, regardless of what the format pattern sepcifies (patch by Bart Broersma, mantis #13076) git-svn-id: trunk@23095 -
This commit is contained in:
parent
c4d8396158
commit
9804fd527b
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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);
|
||||
|
28
tests/webtbs/tw13076.pp
Normal file
28
tests/webtbs/tw13076.pp
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user