[fpc-devel] Rounding inconsistent (critical)

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Oct 2 12:55:38 CEST 2006


On 02/10/06, Vincent Snijders <vsnijders at quicknet.nl> wrote:
> >  AssertEquals('Failing on 10', '0.44', FormatFloat('0.00', 0.445));
> >  AssertEquals('Failing on 11', '0.46', FormatFloat('0.00', 0.455));

Sorry, I shouldn't have used the work expected in my description, as
that does confuse things a bit. You are right with your assumption
though.

Test 10:  I expected 0.44   but got  0.45 from FormatFloat()
Test 11:  I expected 0.46   but got  0.45 from FormatFloat()


Now using your tests:

  AssertEquals('Failing on 6', '0.12', FormatFloat('0.00', 0.125));
  AssertEquals('Failing on 7', '0.38', FormatFloat('0.00', 0.375));

 Test 6: Passed
 Test 7: Failing on 7 expected: <0.38> but was: <0.37>


I gather that this confirms a bug in FPC's banker's rounding.

Regards,
  - Graeme -



More information about the fpc-devel mailing list