]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/nextup.3
e9e578449ef4c4d035765f5e809f766af175313e
[thirdparty/man-pages.git] / man3 / nextup.3
1 .\" Copyright (C) 2016, Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH NEXTUP 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
6 .SH NAME
7 nextup, nextupf, nextupl, nextdown, nextdownf, nextdownl \-
8 return next floating-point number toward positive/negative infinity
9 .SH LIBRARY
10 Math library
11 .RI ( libm ", " \-lm )
12 .SH SYNOPSIS
13 .nf
14 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
15 .B #include <math.h>
16 .PP
17 .BI "double nextup(double " x );
18 .BI "float nextupf(float " x );
19 .BI "long double nextupl(long double " x );
20 .PP
21 .BI "double nextdown(double " x );
22 .BI "float nextdownf(float " x );
23 .BI "long double nextdownl(long double " x );
24 .fi
25 .SH DESCRIPTION
26 The
27 .BR nextup (),
28 .BR nextupf (),
29 and
30 .BR nextupl ()
31 functions return the next representable floating-point number greater than
32 .IR x .
33 .PP
34 If
35 .I x
36 is the smallest representable negative number in the corresponding type,
37 these functions return \-0.
38 If
39 .I x
40 is 0, the returned value is the smallest representable positive number
41 of the corresponding type.
42 .PP
43 If
44 .I x
45 is positive infinity, the returned value is positive infinity.
46 If
47 .I x
48 is negative infinity,
49 the returned value is the largest representable finite negative number
50 of the corresponding type.
51 .PP
52 If
53 .I x
54 is Nan,
55 the returned value is NaN.
56 .PP
57 The value returned by
58 .I nextdown(x)
59 is
60 .IR \-nextup(\-x) ,
61 and similarly for the other types.
62 .SH RETURN VALUE
63 See DESCRIPTION.
64 .\" .SH ERRORS
65 .SH VERSIONS
66 These functions first appeared in glibc in version 2.24.
67 .SH ATTRIBUTES
68 For an explanation of the terms used in this section, see
69 .BR attributes (7).
70 .ad l
71 .nh
72 .TS
73 allbox;
74 lbx lb lb
75 l l l.
76 Interface Attribute Value
77 T{
78 .BR nextup (),
79 .BR nextupf (),
80 .BR nextupl (),
81 .BR nextdown (),
82 .BR nextdownf (),
83 .BR nextdownl ()
84 T} Thread safety MT-Safe
85 .TE
86 .hy
87 .ad
88 .sp 1
89 .SH STANDARDS
90 These functions are described in
91 .I IEEE Std 754-2008 - Standard for Floating-Point Arithmetic
92 and
93 .IR "ISO/IEC TS 18661".
94 .SH SEE ALSO
95 .BR nearbyint (3),
96 .BR nextafter (3)