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