scipy.special.round

scipy.special.round(x, out=None) = <ufunc 'round'>

Round to the nearest integer.

Returns the nearest integer to x. If x ends in 0.5 exactly, the nearest even integer is chosen.

Parameters
xarray_like

Real valued input.

outndarray, optional

Optional output array for the function results.

Returns
scalar or ndarray

The nearest integers to the elements of x. The result is of floating type, not integer type.

Examples

>>> import scipy.special as sc

It rounds to even.

>>> sc.round([0.5, 1.5])
array([0., 2.])