On Wed, Feb 26, 2020 at 6:59 PM <josef.p...@gmail.com> wrote: > > > On Wed, Feb 26, 2020 at 6:09 PM Robert Kern <robert.k...@gmail.com> wrote: > >> On Wed, Feb 26, 2020 at 5:27 PM <josef.p...@gmail.com> wrote: >> >>> great another object array >>> >>> np.asarray([round(x_i.item()) for x_i in np.array([1, 2.5, 2e20, >>> 2e200])]) >>> array([1, 2, 200000000000000000000, >>> >>> >>> 199999999999999993946624442502072331894900655091004725296483501900693696871108151068392676809412503736055024831947764816364271468736556969278770082094479755742047182133579963622363626612334257709776896], >>> dtype=object) >>> >>> >>> I would rather have numpy consistent with numpy than with python >>> >> >> Since round() (and the __round__() interface) is part of Python and not >> numpy, there is nothing in numpy to be consistent with. We only implement >> __round__() for the scalar types. >> > > > Maybe I misunderstand > > I'm using np.round a lot. So maybe it's a question whether and how it will > affect np.round. >
Nope, not changing. > Does the following change with the proposal? > > np.round(np.array([1, 2.5, 2e20, 2e200])) > array([1.e+000, 2.e+000, 2.e+020, 2.e+200]) > > np.round(np.array([1, 2.5, 2e20, 2e200])).astype(int) > array([ 1, 2, -2147483648, -2147483648]) > > np.round(np.array([2e200])[0]) > 2e+200 > > np.round(2e200) > 2e+200 > No change. > round(2e200) > > 199999999999999993946624442502072331894900655091004725296483501900693696871108151068392676809412503736055024831947764816364271468736556969278770082094479755742047182133579963622363626612334257709776896 > Obviously, not under out control, but no, that's not changing. This is the only result that will change: round(np.float64(2e200)) 2e+200 > Josef > "around 100" sounds like "something all_close(100)" > I know. It's meant to be read as "array-round". We prefer the `around()` spelling to avoid shadowing the built-in. Early mistake that we're still living with. -- Robert Kern
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion