Returns the next representable value.
#include <math.h> double nextafter(double x, double y); float nextafterf(float x, float y); long double nextafterl(long double x, long double y);
x
Current representable value.
y
Direction to compute the next representable value.
These functions compute the next representable value, after x in the direction of y. Thus, if y is less than x, nextafter() returns the largest representable floating-point number that is less than x.
This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.
#include <math.h> #include <stdio.h> int main(void) { double x = 7.0; double y; y = x + 1.0; printf("nextafter(%f, %f) = %f\n", x, y, nextafter(x,y)); return 0; } Output: nextafter(7.000000, 8.000000) = 7.000004