dpnp.nextafter

dpnp.nextafter(x1, x2, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)

Return the next floating-point value after x1 towards x2, element-wise.

For full documentation refer to numpy.nextafter.

Parameters:
  • x1 ({dpnp.ndarray, usm_ndarray, scalar}) -- Values to find the next representable value of. Both inputs x1 and x2 can not be scalars at the same time.

  • x2 ({dpnp.ndarray, usm_ndarray, scalar}) -- The direction where to look for the next representable value of x1. Both inputs x1 and x2 can not be scalars at the same time. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

  • 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 -- The next representable values of x1 in the direction of x2. The data type of the returned array is determined by the Type Promotion Rules.

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.

Examples

>>> import dpnp as np
>>> a = np.array(1, dtype=np.float32)
>>> eps = np.finfo(a.dtype).eps
>>> np.nextafter(a, 2) == eps + 1
array(True)
>>> a = np.array([1, 2], dtype=np.float32)
>>> b = np.array([2, 1], dtype=np.float32)
>>> c = np.array([eps + 1, 2 - eps])
>>> np.nextafter(a, b) == c
array([ True,  True])