[Numpy-discussion] Output type of round is inconsistent with python built-in
Robert Kern
robert.kern at gmail.com
Wed Feb 26 18:05:30 EST 2020
On Wed, Feb 26, 2020 at 5:30 PM Ilhan Polat <ilhanpolat at gmail.com> wrote:
> Does this mean that np.round(np.float32(5)) return a 64 bit upcasted int?
>
No. np.round() is an alias (which would be good to deprecate) for
np.around(). No one has proposed changing np.around().
> That would be really awkward for many reasons pandas frame size being
> bloated just by rounding for an example. Or numpy array size growing for no
> apparent reason
>
> I am not really sure if I understand why LSP should hold in this case to
> be honest. Rounding is an operation specific for the number instance and
> not for the generic class.
>
The type of the return value is part of the type's interface, not the
specific instance.
--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200226/fda841d8/attachment-0001.html>
More information about the NumPy-Discussion
mailing list