United States-English |
|
|
HP-UX Reference > Nnextafter(3M)HP-UX 11i Version 3: February 2007 |
|
NAMEnextafter(), nextafterf(), nextafterl(), nextafterw(), nextafterq(), nexttoward(), nexttowardf(), nexttowardl(), nexttowardw(), nexttowardq() — next representable floating-point values SYNOPSIS#include <math.h> double nextafter(double x, double y); float nextafterf(float x, float y); HP Integrity Server Onlylong double nextafterl(long double x, long double y); extended nextafterw(extended x, extended y); quad nextafterq(quad x, quad y); double nexttoward(double x, long double y); float nexttowardf(float x, long double y); long double nexttowardl(long double x, long double y); extended nexttowardw(extended x, long double y); quad nexttowardq(quad x, long double y); DESCRIPTIONThe nextafter() function computes the next representable double-precision 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. The nextafter() function returns y if x equals y. The nexttoward() function is equivalent to nextafter() except that the second parameter has type long double and the function returns y converted to the type of the function if x equals y. The result of the nexttoward() function is determined in the type of the function, without loss of range or precision in a floating second argument, whose type may be wider than the type of the function. nextafterf() is a float versions of nextafter(); it takes float arguments and returns a float result. nextafterl() is a long double version of nextafter(); it takes long double arguments and returns a long double result. nextafterw() is an extended version of nextafter(); it takes extended arguments and returns an extended result. nextafterq() is equivalent to nextafterl() on HP-UX systems. nexttowardf() is a float versions of nexttoward(); it takes a float first argument and returns a float result. nexttowardl() is equivalent to nextafterl(). nexttowardw() is an extended version of nexttoward(); it takes an extended first argument and returns an extended result. nexttowardq() is equivalent to nexttowardl() on HP-UX systems. USAGETo use these functions, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options. To use (for Integrity servers) nextafterw(), nextafterq(), nexttowardw(), or nexttowardq(), compile also with the -fpwidetypes option. Make sure your program includes <math.h>. Link in the math library by specifying -lm on the compiler or linker command line. RETURN VALUEIf x equals y, nextafter() returns y, and nexttoward() returns y converted to the type of x. If x or y is NaN, nextafter() and nexttoward() return NaN. If x is finite and the correct function value would overflow, nextafter() and nexttoward() return ±HUGE_VAL (equal to +INFINITY), according to the sign of x, and raise the overflow exception. If the return value is denormal and x!=y, these functions raise the underflow and inexact floating-point exceptions. |
Printable version | ||
|