nextafter(3M)
NAME
nextafter() − next representable double-precision floating-point number
SYNOPSIS
#include <math.h>
double nextafter(double x, double y);
DESCRIPTION
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.
To use this function, link in the math library by specifying −lm on the compiler or linker command line.
RETURN VALUE
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, nextafter() returns NaN.
If x is finite and the correct function value would overflow, nextafter() returns ±HUGE_VAL (according to the sign of x) and sets errno to [ERANGE].
ERRORS
If nextafter() fails, errno is set to the following value.
[ERANGE] The correct value would overflow.
SEE ALSO
isinf(3M), isnan(3M), limits(5).
STANDARDS CONFORMANCE
nextafter(): SVID3, XPG4.2
Hewlett-Packard Company — HP-UX Release 10.20: July 1996