Next: pow, Previous: nearbyint, Up: Math [Contents][Index]

### 1.45 `nextafter`, `nextafterf`—get next number

Synopsis

    #include <math.h>
    double nextafter(double val, double dir);
    float nextafterf(float val, float dir);

Description
`nextafter` returns the double-precision floating-point number closest to val in the direction toward dir. `nextafterf` performs the same operation in single precision. For example, `nextafter(0.0,1.0)` returns the smallest positive number which is representable in double precision.

Returns
Returns the next closest number to val in the direction toward dir.

Portability
Neither `nextafter` nor `nextafterf` is required by ANSI C or by the System V Interface Definition (Issue 2).