dpnp.fix

dpnp.fix = <DPNPUnaryFunc 'fix'>

Round to nearest integer towards zero.

Round an array of floats element-wise to nearest integer towards zero. The rounded values have the same data-type as the input.

For full documentation refer to numpy.fix.

Parameters:
x{dpnp.ndarray, usm_ndarray}

Input array, expected to have a boolean or real-valued data type.

out{None, dpnp.ndarray, usm_ndarray, tuple of ndarray}, optional

Output array to populate. Array must have the correct shape and the expected data type. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.

Default: None.

order{None, "C", "F", "A", "K"}, optional

Memory layout of the newly output array, if parameter out is None.

Default: "K".

Returns:
outdpnp.ndarray

An array with the same dimensions and data-type as the input. If out is None then a new array is returned with the rounded values. Otherwise the result is stored there and the return value out is a reference to that array.

Warning

This function is deprecated. It is recommended to use dpnp.trunc() instead, as it provides the same functionality of truncating decimal values to their integer parts.

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.])