Python wrappers
Public Python APIs implemented by this engine symbol.Return the next representable floating-point value after a toward b.
Computes element-wise IEEE-754 nextafter: for each element pair
(a_k, b_k) returns the float bit-adjacent to a_k in the
direction of b_k. If a_k == b_k the result is b_k. NaN
propagates.
Math
a_k & \text{if } a_k = b_k \\ \mathrm{succ}(a_k) & \text{if } a_k < b_k \\ \mathrm{pred}(a_k) & \text{if } a_k > b_k \end{cases}$$ where $\mathrm{succ}$ / $\mathrm{pred}$ are the IEEE-754 next- / previous- representable functions.Parameters
aTensorImplPtrSource values. Floating-point dtype (F32 or F64).
bTensorImplPtrDirection values. Must match
a in dtype and broadcast-compatible shape.Returns
TensorImplPtrTensor of the same dtype and broadcast shape as the inputs.
Raises
ValueErrorIf
a and b differ in dtype, or the dtype is not F32 / F64.Notes
Non-differentiable: the output is piecewise constant in a (the step
is always one ULP regardless of magnitude). No backward is registered.
On the GPU stream, the F32 fast path operates entirely on int32 views of the floating bits (sign-magnitude adjusted to two's complement) and avoids a CPU round-trip. F64 inputs always traverse the CPU stream because MLX does not provide F64 buffers.