Format issue lazarus / 31-LCL ---------------------------------------------------------------------- wp · 2012-08-05 16:04 The RTL function "Format" has problems when the format specifier is "%0.9" and the number is between 1e8 and less than 1e9, e.g. Format('%0.9', [1e8]) --> 1 Format('%0.9', [1.2e8]) --> 12 How's that? ---------------------------------------------------------------------- Leledumbo · 2012-08-05 16:41 I think you miss the ArgType part (it's NOT optional AFAIK), I even wonder why it doesn't generate runtime errors. ---------------------------------------------------------------------- Blaazen · 2012-08-05 16:56 @I even wonder why it doesn't generate runtime errors. Both give EConvertError here. There must be something like: Code: [Select]Format('%0.9f', [1e8]); Format('%0.9f', [1.2e8]); ---------------------------------------------------------------------- wp · 2012-08-05 17:27 Sorry, I am embarrassed - I forgot the "g". The first posting should read: Format('%0.9g', [1e8]) --> 1 Format('%0.9g', [1.2e8]) --> 12 ---------------------------------------------------------------------- Blaazen · 2012-08-05 17:41 Then I cannot confirm here. It formats as expected: Format('%0.9g', [1e8]); Format('%0.9g', [1.2e8]); 100000000 120000000 ---------------------------------------------------------------------- wp · 2012-08-05 18:04 A windows issue? I am using Win7, FPC 2.6.0 and a recent snapshot of Lazarus. ---------------------------------------------------------------------- Leledumbo · 2012-08-05 21:50 Since it's part of RTL, it has nothing to do with Lazarus. You might want to check the bugtracker for bugs regarding this function. ---------------------------------------------------------------------- Martin_fr · 2012-08-05 22:51 w32: I get 1 and 12 with fpc 2.6 But it looks ok with 2.4.4 and 2.7.1 (2.7.1 from a while ago) So it may be fixed already. I haven't tested 2.6.1 ---------------------------------------------------------------------- Avishai · 2012-08-06 00:14 It looks fine with 2.6.1