New submission from Michael Garbutt <michael.c.garb...@gmail.com>:
The round() helptext states "The return value is an integer if ndigits is omitted or None. Otherwise the return value has the same type as the number." When given a numpy float64, the return type is also float64, rather than the expected int. >>> import numpy as np >>> value = np.float64(2.1) >>> round(value) 2.0 >>> type(round(value)) <class 'numpy.float64'> Observed in Python 3.8.2, output of pip freeze: certifi==2020.4.5.1 mkl-fft==1.0.15 mkl-random==1.1.0 mkl-service==2.3.0 numpy==1.18.1 six==1.14.0 Also in Python 3.7.2, output of pip freeze: ---------- components: Library (Lib) messages: 368654 nosy: MichaelCG8 priority: normal severity: normal status: open title: round() does not return an integer when given a numpy float64 type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40598> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com