dpnp.rint

dpnp.rint(x, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)

Rounds each element x_i of the input array x to the nearest integer-valued number.

When two integers are equally close to x_i, the result is the nearest even integer to x_i.

For full documentation refer to numpy.rint.

Parameters:
  • x ({dpnp.ndarray, usm_ndarray}) -- Input array, expected to have numeric data type.

  • out ({None, dpnp.ndarray, usm_ndarray}, optional) -- Output array to populate. Array must have the correct shape and the expected data type.

  • order ({"C", "F", "A", "K"}, optional) -- Memory layout of the newly output array, if parameter out is None. Default: "K".

Returns:

out -- An array containing the element-wise rounded values.

Return type:

dpnp.ndarray

Limitations

Keyword argument kwargs is currently unsupported. Otherwise NotImplementedError exception will be raised.

See also

dpnp.round

Evenly round to the given number of decimals.

dpnp.ceil

Compute the ceiling of the input, element-wise.

dpnp.floor

Return the floor of the input, element-wise.

dpnp.trunc

Return the truncated value of the input, element-wise.

Examples

>>> import dpnp as np
>>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
>>> np.rint(a)
array([-2., -2., -0.,  0.,  2.,  2.,  2.])