On Fri, 16 Mar 2007, Jan Dubois wrote: > On Fri, 16 Mar 2007, Su, Yu (Eugene) wrote: > > Interesting. Any explanation why sprintf treats 3.5 and 4.5 > > differently in rounding? > > It is called "unbiased rounding", which has the advantage of not > adding an upward trend to your numbers: > > http://en.wikipedia.org/wiki/Rounding
Please ignore this part, I'm wrong here. Perl's printf() doesn't guarantee unbiased rounding. > Note that Bill's solution probably only does what you want for > positive numbers. For negative numbers you might want to add -0.5 to > achieve the "conventional" symmetric rounding effect. That part is still correct, I think. Cheers, -Jan _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
