This RFC proposes adding `nextafter` function ## Overview Based on array comparison [data](https://github.com/data-apis/array-api-comparison/blob/main/signatures/mathematical-functions-elementwise/nextafter.md), the API is available in most array libraries. The main exception is MXNet which doesn't implement it. ## Prior art - NumPy: https://numpy.org/doc/stable/reference/generated/numpy.nextafter.html#numpy.nextafter - PyTorch: https://pytorch.org/docs/stable/generated/torch.nextafter.html - TensorFlow: https://www.tensorflow.org/api_docs/python/tf/math/nextafter - CuPy: https://docs.cupy.dev/en/stable/reference/generated/cupy.nextafter.html - Dask: https://docs.dask.org/en/stable/generated/dask.array.nextafter.html - JAX: https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.nextafter.html * MXNet doesn't have an implementation for `nextafter` ## Proposal This proposal follows similar element-wise APIs, ``` def nextafter(x1: array, x2: array, /) -> array ``` ## Related - https://github.com/data-apis/array-api/issues/187#issuecomment-1638963751 - `nextafter` is available as part of [C99](https://en.cppreference.com/w/c/numeric/math/nextafter). - `nextafter` has equivalent APIs in the [IEEE 754](http://www.dsc.ufcg.edu.br/~cnum/modulos/Modulo2/IEEE754_2008.pdf) specification as `nextUp`/`nextDown`. - Julia includes [`nextfloat`](https://docs.julialang.org/en/v1/base/numbers/#Base.nextfloat) and [`prevfloat`](https://docs.julialang.org/en/v1/base/numbers/#Base.prevfloat).
This RFC proposes adding
nextafterfunctionOverview
Based on array comparison data, the API is available in most array libraries. The main exception is MXNet which doesn't implement it.
Prior art
nextafterProposal
This proposal follows similar element-wise APIs,
Related
nextafteris available as part of C99.nextafterhas equivalent APIs in the IEEE 754 specification asnextUp/nextDown.nextfloatandprevfloat.