nextafter - next representable double-precision floating-point number
#include <math.h> double nextafter(double x, double y);
The nextafter() function computes the next representable double-precision floating-point value following x in the direction of y. Thus, if y is less than x, nextafter() returns the largest representable floating-point number less than x.
An application wishing to check for error situations should set errno to 0 before calling nextafter(). If errno is non-zero on return, or the value NaN is returned, an error has occurred.
The nextafter() function returns the next representable double-precision floating-point value following x in the direction of y.
If x or y is NaN, then nextafter() returns NaN and may set errno to [EDOM].
If x is finite and the correct function value would overflow, HUGE_VAL is returned and errno is set to [ERANGE].
The nextafter() function will fail if:
- The correct value would overflow.
The nextafter() function may fail if:
- The x or y argument is NaN.