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
48 attributes(7).
49
50 ┌─────────────────────────────────────┬───────────────┬─────────┐
51 │Interface │ Attribute │ Value │
52 ├─────────────────────────────────────┼───────────────┼─────────┤
53 │nextup(), nextupf(), nextupl(), │ Thread safety │ MT-Safe │
54 │nextdown(), nextdownf(), nextdownl() │ │ │
55 └─────────────────────────────────────┴───────────────┴─────────┘
57 These functions are described in IEEE Std 754-2008 - Standard for
58 Floating-Point Arithmetic and ISO/IEC TS 18661.
59
61 nearbyint(3), nextafter(3)
62
64 This page is part of release 4.16 of the Linux man-pages project. A
65 description of the project, information about reporting bugs, and the
66 latest version of this page, can be found at
67 https://www.kernel.org/doc/man-pages/.
68
69
70
71GNU 2017-09-15 NEXTUP(3)