From: Charles R H. <cha...@gm...> - 2006-10-11 20:28:20
|
On 10/11/06, Greg Willden <gre...@gm...> wrote: > > Hi All, > > I've read discussions in the archives about how round() "rounds to even" > and how that is supposedly better. > > But what I haven't been able to find is "What do I use if I want the > regular old round that you learn in school?" Perhaps you could explain *why* you want the schoolbook round? Given that floating point is inherently inaccurate you would have to expect to produce a lot of numbers exactly of the form x.5 *without errors*, which means you probably don't need round to deal with it. Anyway, absent a flag somewhere, you can do something like (x + sign(x)*.5).astype(int). Chuck |