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

David Emerson dle3ab at angelbase.com
Wed Aug 14 08:47:50 CEST 2013


Thanks for the suggestions, guys!

José Mejuto wrote:
 > SimpleRoundTo I think.

But I want an integer result, and this returns a floating point.

Sven Barth wrote:
> Take a look at SetRoundMode in unit Math:
> http://www.freepascal.org/docs-html/rtl/math/setroundmode.html

After calling SetRoundMode(rmNearest);
I find that system.round() is still doing banker's rounding. Am I 
missing something?

I don't see this TfpuRoundingMode mentioned anywhere in the 
documentation, other than the "get" and "set" functions for the same. 
What does it effect?


...
Anyway I guess I am going to have to write my own round() function :P

Cheers,
~David.




More information about the fpc-pascal mailing list