1NEXTAFTER(3)               Linux Programmer's Manual              NEXTAFTER(3)
2
3
4

NAME

6       nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl
7       - floating-point number manipulation
8

SYNOPSIS

10       #include <math.h>
11
12       double nextafter(double x, double y);
13       float nextafterf(float x, float y);
14       long double nextafterl(long double x, long double y);
15
16       double nexttoward(double x, long double y);
17       float nexttowardf(float x, long double y);
18       long double nexttowardl(long double x, long double y);
19
20       Link with -lm.
21
22   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
23
24       nextafter():
25           _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 ||
26           _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE ||
27           _POSIX_C_SOURCE >= 200112L;
28           or cc -std=c99
29       nextafterf(), nextafterl():
30           _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
31           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
32           or cc -std=c99
33       nexttoward(), nexttowardf(), nexttowardl():
34           _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE ||
35           _POSIX_C_SOURCE >= 200112L;
36           or cc -std=c99
37

DESCRIPTION

39       The nextafter() functions return the next representable  floating-point
40       value  following  x  in the direction of y.  If y is less than x, these
41       functions will return the largest representable number less than x.
42
43       If x equals y, the functions return y.
44
45       The nexttoward() functions do the same as  the  nextafter()  functions,
46       except that they have a long double second argument.
47

RETURN VALUE

49       On  success,  these  functions  return the next representable floating-
50       point value after x in the direction of y.
51
52       If x equals y, then y (cast to the same type as x) is returned.
53
54       If x or y is a NaN, a NaN is returned.
55
56       If x is finite, and the result would overflow, a  range  error  occurs,
57       and  the  functions  return  HUGE_VAL, HUGE_VALF, or HUGE_VALL, respec‐
58       tively, with the correct mathematical sign.
59
60       If x is not equal to y, and the correct function result would  be  sub‐
61       normal,  zero,  or underflow, a range error occurs, and either the cor‐
62       rect value (if it can be represented), or 0.0, is returned.
63

ERRORS

65       See math_error(7) for information on how to determine whether an  error
66       has occurred when calling these functions.
67
68       The following errors can occur:
69
70       Range error: result overflow
71              An overflow floating-point exception (FE_OVERFLOW) is raised.
72
73       Range error: result is subnormal or underflows
74              An underflow floating-point exception (FE_UNDERFLOW) is raised.
75
76       These functions do not set errno.
77

CONFORMING TO

79       C99, POSIX.1-2001.  This function is defined in IEC 559 (and the appen‐
80       dix with recommended functions in IEEE 754/IEEE 854).
81

BUGS

83       In glibc version 2.5 and earlier,  these  functions  do  not  raise  an
84       underflow  floating-point  (FE_UNDERFLOW)  exception  when an underflow
85       occurs.
86

SEE ALSO

88       nearbyint(3)
89

COLOPHON

91       This page is part of release 3.53 of the Linux  man-pages  project.   A
92       description  of  the project, and information about reporting bugs, can
93       be found at http://www.kernel.org/doc/man-pages/.
94
95
96
97GNU                               2010-09-20                      NEXTAFTER(3)
Impressum