# nexttoward(3) [freebsd man page]

```NEXTAFTER(3)						   BSD Library Functions Manual 					      NEXTAFTER(3)

NAME
nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl -- next representable value

LIBRARY
Math Library (libm, -lm)

SYNOPSIS
#include <math.h>

double
nextafter(double x, double y);

float
nextafterf(float x, float y);

long double
nextafterl(long double x, long double y);

double
nexttoward(double x, long double y);

float
nexttowardf(float x, long double y);

long double
nexttowardl(long double x, long double y);

DESCRIPTION
These functions return the next machine representable number from x in direction y.

ieee(3), math(3)

STANDARDS
The nextafter(), nextafterf(), nextafterl(), nexttoward(), nexttowardf(), and nexttowardl() routines conform to ISO/IEC 9899:1999
(``ISO C99'').  They implement the Nextafter function recommended by IEEE Std 754-1985, with the extension that nextafter(+0.0,, -0.0)
returns -0.0, and nextafter(-0.0,, +0.0) returns +0.0.

HISTORY
The nextafter() function appeared in 4.3BSD, and nextafterf() appeared in FreeBSD 2.0.

BSD								    May 4, 2005 							       BSD```

## Check Out this Related Man Page

```NEXTAFTER(3)							libc math functions						      NEXTAFTER(3)

NAME
nextafter, nexttoward - floating point number manipulation

SYNOPSIS
#include <math.h>

double nextafter(double x, double y);
float nextafterf(float x, float y);
long double nextafterl(long double x, long double y);

double nexttoward(double x, long double y);
float nexttowardf(float x, long double y);
long double nexttowardl(long double x, long double y);

DESCRIPTION
The  nextafter()  functions return the next representable neighbor of x in the direction towards y.  The size of the step between x and the
result depends on the type of the result.  If x = y the function simply returns y.  If either value is NaN, then NaN is	returned.   Other-
wise a value corresponding to the value of the least significant bit in the mantissa is added or subtracted, depending on the direction.

The nexttoward() functions do the same as the nextafter() functions, except that they have a long double second argument.

These functions will signal overflow or underflow if the result goes outside of the range of normalized numbers.

CONFORMING TO
C99. This function is defined in IEC 559 (and the appendix with recommended functions in IEEE 754/IEEE 854).