dpnp.trunc
- dpnp.trunc(x, /, out=None, *, order='K', where=True, dtype=None, subok=True, **kwargs)[source]
Compute the truncated value of the input, element-wise.
For full documentation refer to
numpy.trunc.- Returns:
out – The truncated value of each element of x.
- Return type:
dpnp.ndarray
Limitations
Parameter x is only supported as either
dpnp.ndarrayordpctl.tensor.usm_ndarray. Parameters where, dtype, and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise the function will be executed sequentially on CPU. Input array data types are limited by real-value data types.See also
dpnp.floorRound a number to the nearest integer toward minus infinity.
dpnp.ceilRound a number to the nearest integer toward infinity.
Examples
>>> import dpnp as np >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) >>> np.trunc(a) array([-1.0, -1.0, -0.0, 0.0, 1.0, 1.0, 2.0])