[Numpy-discussion] bug in round with negative number of decimals
Charles R Harris
charlesr.harris at gmail.com
Mon Sep 4 14:40:01 CDT 2006
On 9/4/06, Sebastian Haase <haase at msg.ucsf.edu> wrote:
> Paulo J. S. Silva wrote:
> > Once again, the information that singed zero is part of IEEE standard is
> > in the paper I cited in my last message.
> > It is very important to be able to compute the sign of an overflowed
> > quantity in expressions like 1/x when x goes to zero.
> > Best,
> > Paulo
> This is all very interesting ( and confusing (to me, maybe others) at
> the same time ...) ...
> Question 0: Are you sure this is not a bug ?
> >>> N.array().round(-1)
That does look like a bug.
I suspect it is related to the integer data type of the first example. The
code probably does something like this:
and 66/10 == 6 in integer arithmetic.
> [ 70.]
> Question 1: Was this way of round already in Numeric and /or in numarray ?
Question 2: Does this need to be better documented (complete and
> corrected(!) docstrings - maybe a dedicated wiki page ) !?
> This is related to "How does Matlab or IDL or others do rounding ?" -
> This would at least determine how many people would be surprised by this.
> (I would say that *if* Matlab rounds the same way, we might need less
> documentation ...)
I have improved the document strings and the example at scipy.org.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion