[Numpy-discussion] np.trunc is inconsistent with array-api

Aaron Meurer asmeurer at gmail.com
Thu Sep 9 18:49:45 EDT 2021


On Sat, Sep 4, 2021 at 2:03 AM Kshitij Kalambarkar
<kshitijkalambarkar at gmail.com> wrote:
>
> Hi,
>
> np.trunc returns floating dtype output even for integral dtype input. As per array-api, it should preserve the input dtype.
>
> Note: This is also true for np.rint, np.fix, np.ceil, np.floor

Probably worth noting that np.round (np.around) already returns the
same data type as the input.

Aaron Meurer

>
> Reference: https://github.com/numpy/numpy/issues/19464
>
> Possible Fix:
> 1. We update the behaviour directly with an update to release note.
> 2. We add a FutureWarning and update the behaviour in a future release.
>
> This email is to gauge the preference for the fix.
>
> Thank You!
>
> Regards,
> Kshiteej K
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list