[fpc-pascal] math round vs banker's round

José Mejuto joshyfun at gmail.com
Wed Aug 14 00:00:03 CEST 2013


El 13/08/2013 23:47, David Emerson escribió:
> Hi all,
>
> I have just discovered that the system.round function has this very odd
> behavior of rounding towards an even number when the fractional part is
> .5 -- in the system.round documentation this is described as "banker's
> rounding"
>
> I do not like this behavior. How can I use a more
> mathematically-traditional round function, which always rounds .5 up,
> and everything below .5 down?
>
> Do I need to write this function myself?

Hello,

SimpleRoundTo I think.

Maybe documentation should be changed to add SimpleRoundTo in cross 
referenced functions and note that SimpleRoundTo uses classic round 
system instead bankers one.

-- 




More information about the fpc-pascal mailing list