Hi all,

there is a discussion about how `round(array)` should behave in:

    https://github.com/numpy/numpy/issues/6248

There is some discussion about object arrays which should probably be
fixed for `around()` in that ago.

Otherwise, the is the question what to do about the fact that:

* round(np.float64(2.**64))  -> 18446744073709551616  (a Python int)
* round(np.array([2., 3., 2.**64])  can only return float or integer

The NumPy `np.round`/`np.around` (same function) functions always
return the same dtype.

We can either ignore that discrepancy, or opt to raise an error, so
that:

    >>> round(np.array([2., 3.5]))
    TypeError: Rounding a NumPy float array cannot return integers,
    use `round(arr, ndigits=0)` or `round(arr, 0) to indicate that a
    float result is desired.

In the call today, I think we leaned a bit towards ignoring it, but if
I read Aaron correctly, he prefers the error and it may be the
conservative choice.

We could of course do other things (i.e. return an integer `intp`
array) but that would probably require a hard error for overflows
(which is different from `np.rint(arr).astype(np.intp)`.

Are there any small or big opinions on this?  It seems useful to enable
`round()` and is a bit of a shame to get caught up on the detail, but I
am not sure what the right choice is :).

- Sebastian

_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to