[fpc-devel] FormatFloat bug

Jonas Maebe jonas.maebe at elis.ugent.be
Wed May 30 11:19:05 CEST 2007


On 30 mei 2007, at 11:10, Michael Van Canneyt wrote:

> Not that I know of. As far as I know, it's left up to the CPU.
> But it's been a long time since I looked at this, so I might
> be wrong.

The writing of floating point values does not use the rounding  
functionality provided by the FPU, it is implemented in a completely  
cpu-independent way. Further, this program:

var
   c: currency;
begin
   c:=0.005;
   writeln(c:0:2);
end.

writes 0.01. So it's probably a bug in one of the umpteen sysutils  
float formatting "helpers" (and if someone fixes it, please take into  
account that most cpus have comp=currency=int64, and that most do not  
support the extended types; there have been many bugs on different  
platforms in the past because of wrong assumptions about this in the  
past).


Jonas



More information about the fpc-devel mailing list