http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49048

--- Comment #8 from Cecilio <s.cecilio at gmail dot com> 2011-05-19 17:01:15 
UTC ---
Thanks again, Paolo and Jackub, for your help and explanations. Believe it or
not, I a have a PhD and had to learn a lot of complex mathematics, but I never
heard about so many types of 'rounding' methods. To me, rounding had always
meant round-half-up (banker's rounding): 5.5 rounds up to 6 and 6.5 rounds up
to 7. As this is also the normally required method for financial calculations,
I can not understand the usefulness of printf sometimes rounding up and others
rounding down, as it is the behaviour of round-half-even method. But once I've
learn that (thanks for this) I know that I can no longer rely on setprecision
or printf, and that I have to implement my rounding methods to get the banker's
rounding behaviour. 

I'm wondering how many financial programs are there relying on setprecision
without having noticed its 'problematic' rounding behaviour, caused by printf
and blessed by ISO c++ standard. ;-)

It's been a pleasure taking to both and learning with your help. 
With my best regards,
Cecilio

Reply via email to