[fpc-devel] Freepascal 2.2.4rc1 released

Graeme Geldenhuys graemeg.lists at gmail.com
Wed Jan 28 11:07:52 CET 2009

I think I found a possible issue with 2.2.4.
I can not recall experiencing this issue under 2.2.3 (from mid December 2008).

I have data (tax rates) stored in a Firebird 2.1 database. The field
storing the rate is defined as Numeric(3,3).  I use SqlDB (via tiOPF)
to retrieve the data. That specific column is retrieved as follows:

  lData.Rate        := Query.FieldAsFloat['TAXRATE'];

lData.Rate  is declared as a Single type.

When I display the taxrate under Linux using the following method,
everything works as expected.

function DisplayPercentage(const AValue: Single): string;
  writeln('AValue = ', AValue);
  Result := Format('%.2f', [AValue]);
  writeln('Formatted Avalue = ', Result);

Output under Linux:
AValue =  0.000001192E+00
Formatted Avalue = 0.00
AValue =  1.400000012E+01
Formatted Avalue = 14.00

When I display it under Windows (2000 or XP) I get a vastly different answer.

Output under Windows 2000 & XP
AValue =  4.249977051E+03

Formatted AValue = 4249.98


AValue =  4.249440918E+03

Formatted AValue = 4249.44


As you can see the values are very different!!  I have no idea why.

I'm using FPC checked out from:
   Revision: 12619

Both Linux and Windows systems are using the exact same revision of
FPC.  I'll try and put together a small test project and see if I can
pinpoint the exact location of the issue.

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the fpc-devel mailing list