[Numpy-discussion] bug in round with negative number of decimals

Sebastian Haase haase at msg.ucsf.edu
Sun Sep 3 20:03:39 EDT 2006


Hi,
I just learn about the existence of round().
Is the following exposing a bug?
 >>> N.__version__
'1.0b4'
 >>> N.array([65.0])
[ 65.]
 >>> _.round(-1)
[ 60.]
 >>> round(65, -1)
70.0
 >>> N.array([65])
[65]
 >>> _.round(-1)
[60]
 >>> N.array([66])
[66]
 >>> _.round(-1)
[60]
 >>> N.array([66.2])
[ 66.2]
 >>> _.round(-1)
[ 70.]

65 should round *up* to 70. (when decimals is given as -1)
In numpy even 66 rounds down, but 66.2 rounds up ...

- Sebastian Haase




More information about the NumPy-Discussion mailing list