1NEXTUP(3) Linux Programmer's Manual NEXTUP(3)
2
3
4
6 nextup, nextupf, nextupl, nextdown, nextdownf, nextdownl - return next
7 floating-point number toward positive/negative infinity
8
10 #define _GNU_SOURCE /* See feature_test_macros(7) */
11 #include <math.h>
12
13 double nextup(double x);
14 float nextupf(float x);
15 long double nextupl(long double x);
16
17 double nextdown(double x);
18 float nextdownf(float x);
19 long double nextdownl(long double x);
20
21 Link with -lm.
22
24 The nextup(), nextupf(), and nextupl() functions return the next repre‐
25 sentable floating-point number greater than x.
26
27 If x is the smallest representable negative number in the corresponding
28 type, these functions return -0. If x is 0, the returned value is the
29 smallest representable positive number of the corresponding type.
30
31 If x is positive infinity, the returned value is positive infinity. If
32 x is negative infinity, the returned value is the largest representable
33 finite negative number of the corresponding type.
34
35 If x is Nan, the returned value is NaN.
36
37 The value returned by nextdown(x) is -nextup(-x), and similarly for the
38 other types.
39
41 See DESCRIPTION.
42
44 These functions first appeared in glibc in version 2.24.
45
47 For an explanation of the terms used in this section, see at‐
48 tributes(7).
49
50 ┌────────────────────────────────────────────┬───────────────┬─────────┐
51 │Interface │ Attribute │ Value │
52 ├────────────────────────────────────────────┼───────────────┼─────────┤
53 │nextup(), nextupf(), nextupl(), nextdown(), │ Thread safety │ MT-Safe │
54 │nextdownf(), nextdownl() │ │ │
55 └────────────────────────────────────────────┴───────────────┴─────────┘
56
58 These functions are described in IEEE Std 754-2008 - Standard for
59 Floating-Point Arithmetic and ISO/IEC TS 18661.
60
62 nearbyint(3), nextafter(3)
63
65 This page is part of release 5.12 of the Linux man-pages project. A
66 description of the project, information about reporting bugs, and the
67 latest version of this page, can be found at
68 https://www.kernel.org/doc/man-pages/.
69
70
71
72GNU 2021-03-22 NEXTUP(3)