Updated: 2022/Sep/29

Please read Privacy Policy. It's for your privacy.

NEXTAFTER(3) Library Functions Manual NEXTAFTER(3)NAMEnextafter,nextafterf,nextafterl,nexttoward,nexttowardf,nexttowardl- next representable floating-point numberLIBRARYMath Library (libm, -lm)SYNOPSIS#include<math.h>doublenextafter(double x, double y); floatnextafterf(float x, float y); long doublenextafterl(long double x, long double y); doublenexttoward(double x, long double y); floatnexttowardf(float x, long double y); long doublenexttowardl(long double x, long double y);DESCRIPTIONThenextafter(),nextafterf(), andnextafterl() functions return the next machine representable number from x in direction of y. In other words, if y is less than x, the functions return the largest representable floating-point number less than x. When x equals y, the value of y is returned. The three functions differ only in the type of the return value and x. Thenexttoward() andnexttowardf() functions are equivalent to thenextafter() family of functions with two exceptions: 1. The second parameter has a type long double. 2. The return value is y converted to the type of the function, provided that x equals y.nexttowardl() is equivalent tonextafterl().RETURNVALUESUpon successful completion, the described functions return the next representable floating-point value as described above. If x is finite but an overflow would occur, a range error follows and the functions return +-HUGE_VAL, +-HUGE_VALF, or +-HUGE_VALL with the same sign as x. When either x or y is NaN, a NaN is returned. When x is not y but the function value is subnormal, zero, or underflows, a range error occurs, and either 0.0 or the correct function value (if representable) is returned.SEE ALSOmath(3)STANDARDSThe described functions conform to ISO/IEC 9899:1999 ("ISO C99"). NetBSD 10.99 September 13, 2015 NetBSD 10.99