Yep, searching for the banker's algorithm--especially with respect to Math.Round--leads into many different discussions/rants and other algorithms. Generally, I've found the discussions lead to "avoid Math.Round and implement your own".
But, we don't have the ability of overriding how System.Drawing classes invoke Round, like Math.Round in .NET 2.0. Which is all well and good; if I have to roll-my-own Round (especially in general, if using .NET 1.x), then so be it. But, I would at least expect System.Drawing.*.Round() to be useful to someone, like Math.Round() (if only to bankers). I fail to see the usefulness of System.Drawing.*.Round (). On Thu, 20 Apr 2006 12:34:17 -0400, J. Merrill <[EMAIL PROTECTED]> wrote: >If you pass integers derived from floats (where the fractional parts are simply truncated) you can get a not-banker-rounded result by adding 0.5 to the float values (that will be truncated). > >But I think your point is well taken -- in the context of computing pixel positions (that are inherently integral) you don't want banker's rounding to be used. > >Perhaps that's why many math libraries include more than one set of rounding methods... > >At 09:21 AM 4/20/2006, Peter Ritchie wrote >>Except--unlike mathematical calculations--with drawing, I want >>consistency; not statistical unbiasedness as my number of calculations >>approach infinity. I certainly don't want all my even coordinate pixels >>to be on one side of the line and all my odd coordinate pixels to be on >>the other. >>[snip] =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
