[issue36879] bug with round() and "numpy floats"

Scaler report at bugs.python.org
Fri May 10 16:51:01 EDT 2019


New submission from Scaler <balaton22 at hotmail.com>:

round()'s documentation (https://docs.python.org/3/library/functions.html#round) says that "The return value is an integer if ndigits is omitted or None."

Works well with "built-in floats", but not with "numpy floats" (didn't know they were different):
>>> import numpy as np
>>> round(5.5)
6
>>> round(np.round(5.5)-0.5)
6.0



As a side note, is there any reason why round() does not return value as an integer if ndigits is 0 or negative also?

----------
messages: 342132
nosy: Scaler
priority: normal
severity: normal
status: open
title: bug with round() and "numpy floats"
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36879>
_______________________________________


More information about the Python-bugs-list mailing list