[fpc-pascal] math round vs banker's round
ludo.brands at free.fr
Wed Aug 14 08:38:06 CEST 2013
On 08/14/2013 08:03 AM, Sven Barth wrote:
> Am 13.08.2013 23:48 schrieb "David Emerson" <dle3ab at angelbase.com
> <mailto:dle3ab at angelbase.com>>:
>> 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?
> Take a look at SetRoundMode in unit Math:
None of the round modes gives the result OP wants. Furthermore,
SetRoundMode is a runtime setting and
The compiler hard codes (x64) a movabs $0x0,%rdx and
More information about the fpc-pascal