jax.lax.nextafter
Contents
jax.lax.nextafter#
- jax.lax.nextafter(x1,x2)[source]#
Returns the next representable value after
x1in the direction ofx2.This function lowers directly to the
chlo.next_afteroperation.- Parameters:
x1 (ArrayLike) – input arrays. Must have a matching floating-point dtypes. If neither isa scalar, must have the same number of dimensions and be broadcast-compatible.
x2 (ArrayLike) – input arrays. Must have a matching floating-point dtypes. If neither isa scalar, must have the same number of dimensions and be broadcast-compatible.
- Returns:
Array of the same dtype and broadcasted shape of the inputs, containing thenext representable floating-point value after
x1in the direction ofx2.- Return type:
Notes
In some environments flush-denormal-to-zero semantics is used.This means that, around zero, this function returns strictly non-zerovalues which appear as zero in any operations. Consider this example:
>>>fromjaximportlax>>>lax.nextafter(0.0,1.0)# denormal numbers are representableArray(1.e-45, dtype=float32, weak_type=True)>>>lax.nextafter(0.0,1.0)*1# but are flushed to zeroArray(0., dtype=float32, weak_type=True)
For the smallest usable (i.e. normal) float, use
tinyofjnp.finfo.
