I've got to prepare the explanation for the users who will come to see me with their calculators in their hands (as well as in my hand)
.
Helpppppppppp
It looks to me like you've stumbled onto a Free Pascal bug. Delphi gives 547.64. Also, FPC's FloatToStrF gives 547.64. As would common sense rounding.
Try this code:
program test1;
uses
SysUtils;
begin
WriteLn(CurrToStrF((1000000-1) / 1826, ffnumber, 4)); //547.6446
WriteLn(CurrToStrF((1000000-1) / 1826, ffnumber, 2)); //547.65 on FPC, 547.64 on Delphi
WriteLn(FloatToStrF((1000000-1) / 1826, ffnumber, 10, 4)); //547.6446
WriteLn(FloatToStrF((1000000-1) / 1826, ffnumber, 10, 2)); //547.64
end.
FPC's rtf.pdf says this about CurrToStrF: "Calling CurrToStr is equivalent to calling FloatToStrF", but that's not what we're seeing here. Please file a bug report on Mantis. Click FPC, not Lazarus at the top of Mantis.
Since Currency is a different type than Double, I would guess that maybe some place there's a conversion issue going on.
In the meantime, you can use FloatToStrF instead of CurrToStrF.
Thanks.
-Phil