2 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
6 .\" SPDX-License-Identifier: GPL-1.0-or-later
8 .\" Based on glibc infopages
10 .TH nextafter 3 (date) "Linux man-pages (unreleased)"
12 nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl \-
13 floating-point number manipulation
16 .RI ( libm ", " \-lm )
21 .BI "double nextafter(double " x ", double " y );
22 .BI "float nextafterf(float " x ", float " y );
23 .BI "long double nextafterl(long double " x ", long double " y );
25 .BI "double nexttoward(double " x ", long double " y );
26 .BI "float nexttowardf(float " x ", long double " y );
27 .BI "long double nexttowardl(long double " x ", long double " y );
31 Feature Test Macro Requirements for glibc (see
32 .BR feature_test_macros (7)):
37 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
38 || _XOPEN_SOURCE >= 500
39 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
40 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
41 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
47 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
48 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
49 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
56 _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE
57 || _POSIX_C_SOURCE >= 200112L
65 functions return the next representable floating-point value following
73 these functions will return the largest representable number less than
88 functions do the same as the corresponding
90 functions, except that they have a
95 these functions return the next representable floating-point value after
106 (cast to the same type as
121 and the result would overflow,
122 a range error occurs,
123 and the functions return
128 respectively, with the correct mathematical sign.
134 and the correct function result would be subnormal, zero, or underflow,
135 a range error occurs,
136 and either the correct value (if it can be represented),
141 for information on how to determine whether an error has occurred
142 when calling these functions.
144 The following errors can occur:
146 Range error: result overflow
147 .\" e.g., nextafter(DBL_MAX, HUGE_VAL);
151 An overflow floating-point exception
155 Range error: result is subnormal or underflows
156 .\" e.g., nextafter(DBL_MIN, 0.0);
160 An underflow floating-point exception
164 For an explanation of the terms used in this section, see
170 Interface Attribute Value
180 T} Thread safety MT-Safe
185 This function is defined in IEC 559 (and the appendix with
186 recommended functions in IEEE 754/IEEE 854).
190 In glibc 2.5 and earlier, these functions do not raise an underflow
193 exception when an underflow occurs.
196 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6799
197 these functions did not set