On Wed, Apr 13, 2016 at 8:06 AM, <josef.p...@gmail.com> wrote: > > The difference is that Python 3 has looooong ints, (and doesn't have to > overflow, AFAICS) >
This is a good point. But if your float is so big that rounding it to an integer would overflow int64, rounding is already a no-op. I'm sure this has been done before but I would guess it's quite rare. I would be OK raising in this situation, especially because np.around will still be around returning floats. > what happens with nan? > I guess inf would overflow? > builtins.round raises for both of these (in Python 3) and I would propose copying this behavior: In [52]: round(float('inf')) --------------------------------------------------------------------------- OverflowError Traceback (most recent call last) <ipython-input-52-798e0e9243d6> in <module>() ----> 1 round(float('inf')) OverflowError: cannot convert float infinity to integer In [53]: round(float('nan')) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-53-e989485df64c> in <module>() ----> 1 round(float('nan')) ValueError: cannot convert float NaN to integer
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion