The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

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.

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.

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, 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].

ERRORS

The nextafter() function will fail if:

[ERANGE]
The correct value would overflow.

The nextafter() function may fail if:

[EDOM]
The x or y argument is NaN.

EXAMPLES

None.

APPLICATION USAGE

None.

FUTURE DIRECTIONS

None.

SEE ALSO

<math.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]