1nextup(3) Library Functions 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 Math library (libm, -lm)
11
13 #define _GNU_SOURCE /* See feature_test_macros(7) */
14 #include <math.h>
15
16 double nextup(double x);
17 float nextupf(float x);
18 long double nextupl(long double x);
19
20 double nextdown(double x);
21 float nextdownf(float x);
22 long double nextdownl(long double x);
23
25 The nextup(), nextupf(), and nextupl() functions return the next repre‐
26 sentable floating-point number greater than x.
27
28 If x is the smallest representable negative number in the corresponding
29 type, these functions return -0. If x is 0, the returned value is the
30 smallest representable positive number of the corresponding type.
31
32 If x is positive infinity, the returned value is positive infinity. If
33 x is negative infinity, the returned value is the largest representable
34 finite negative number of the corresponding type.
35
36 If x is Nan, the returned value is NaN.
37
38 The value returned by nextdown(x) is -nextup(-x), and similarly for the
39 other types.
40
42 See DESCRIPTION.
43
45 For an explanation of the terms used in this section, see at‐
46 tributes(7).
47
48 ┌────────────────────────────────────────────┬───────────────┬─────────┐
49 │Interface │ Attribute │ Value │
50 ├────────────────────────────────────────────┼───────────────┼─────────┤
51 │nextup(), nextupf(), nextupl(), nextdown(), │ Thread safety │ MT-Safe │
52 │nextdownf(), nextdownl() │ │ │
53 └────────────────────────────────────────────┴───────────────┴─────────┘
54
56 These functions are described in IEEE Std 754-2008 - Standard for
57 Floating-Point Arithmetic and ISO/IEC TS 18661.
58
60 glibc 2.24.
61
63 nearbyint(3), nextafter(3)
64
65
66
67Linux man-pages 6.04 2023-03-30 nextup(3)