[fpc-devel]bug or feature?

Jonas Maebe jonas at zeus.rug.ac.be
Sat Feb 3 22:31:21 CET 2001


On Sat, 3 Feb 2001, òÏÍÁÎ èÌÙÎÏ×ÓËÉÊ wrote:

> Hello, i'm not subscribed to fpc's mailing list, so it would be great if answer 
> would be forwarded to my e-mail. the problem is:
> ------------------------------------------------------------
> [dr at dr.lnx.home.kz][dr]$> cat d.pas                                        
> begin
> writeln(round(9/2));
> end.
> [dr at dr.lnx.home.kz][dr]$> fpc d.pas
> Free Pascal Compiler version 1.0.4 [2000/12/18] for i386
> Copyright (c) 1993-2000 by Florian Klaempfl
> Target OS: Linux for i386
> Compiling d.pas
> Assembling program
> Linking d
> 3 Lines compiled, 1.7 sec
> [dr at dr.lnx.home.kz][dr]$> ./d
> 4

The rounding is done by the FPU, which uses the "round to nearest even"
number or something like that. It's not that way (since round(3.1)
will return 3), but it is that way with .5. It's calle "accountant
rounding" or "financial rounding" or something like that.


Jonas





More information about the fpc-devel mailing list