dpnp.fix

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

Round to nearest integer towards zero.

Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats.

For full documentation refer to numpy.fix.

Parameters:
  • x ({dpnp.ndarray, usm_ndarray}) -- An array of floats to be rounded.

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

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

Returns:

out -- An array with the rounded values and with the same dimensions as the input. The returned array will have the default floating point data type for the device where a is allocated. If out is None then a float array is returned with the rounded values. Otherwise the result is stored there and the return value out is a reference to that array.

Return type:

dpnp.ndarray

Limitations

Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise NotImplementedError exception will be raised.

See also

dpnp.round

Round to given number of decimals.

dpnp.rint

Round elements of the array to the nearest integer.

dpnp.trunc

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

dpnp.floor

Return the floor of the input, element-wise.

dpnp.ceil

Return the ceiling of the input, element-wise.

Examples

>>> import dpnp as np
>>> np.fix(np.array(3.14))
array(3.)
>>> np.fix(np.array(3))
array(3.)
>>> a = np.array([2.1, 2.9, -2.1, -2.9])
>>> np.fix(a)
array([ 2.,  2., -2., -2.])